[CLOSED] Can fully control gridpanel in code behind?

Page 1 of 2 12 LastLast
  1. #1

    [CLOSED] Can fully control gridpanel in code behind?

    I'm the newcomer with ext.net and I want to know is there anyway to fully control the gridpanel in code behind.
    Because I want to build 1 search page with the gridpanel to display with a lot dynamic input parameter(over 15) and trigger it by a button. I search the forum and look the demo, almost is the simple and automatic one. (becos it's an internal project I can't provide the code)
    • I can bind data with code behind but don't know how to set the total page to the grid. If add the proxy in the gridpanel, I can't use the code to bind data to grid. So is there any way to set total page to paging control without proxy, handler
    • How to do manual paging and sorting with code behind without proxy, handler

    Thanks.
    Last edited by Daniil; Jan 15, 2013 at 10:01 AM. Reason: [CLOSED]
  2. #2
    Hi @asiaesolutions,

    Welcome to Ext.NET!

    Please clarify why can't you use a Proxy to organize remote paging? It is the easiest way.

    Did you see these examples?
    https://examples2.ext.net/#/GridPane..._Sorting/Page/
    https://examples2.ext.net/#/GridPane.../DirectMethod/
  3. #3
    If I using proxy, when click the search button I can't bind the data to the gridpanel but when remove the proxy all ok.
    If I set the autoload data to false, is there any way to trigger the load data in code behind when I got all the search parameter from the search form if I using proxy or remote method?
    Because the data over 300k records with many filter parameter so I want to fully control it than any autoway. If can control it like the original asp.net gridview is better.
  4. #4
    Quote Originally Posted by asiaesolutions View Post
    If I using proxy, when click the search button I can't bind the data to the gridpanel but when remove the proxy all ok.
    Unfortunately, it is hard to say something concrete here without a sample to reproduce.

    Quote Originally Posted by asiaesolutions View Post
    If I set the autoload data to false, is there any way to trigger the load data in code behind when I got all the search parameter from the search form if I using proxy or remote method?
    Loading the data without any Proxy.
    https://examples2.ext.net/#/GridPane...d/Remote_Load/

    If the Store is configured with some Proxy, when you can just call
    App.GridPanel1.getStore().load();
    It is JavaScript.
  5. #5
    Here example, If I want to load data like this, which proxy is used? And how to implement remote sorting and paging.
    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">
        protected void Button1_Click(object sender, DirectEventArgs e)
        {
            Search(0, 10);
        }
    
        protected void Search(int startindex, int limit)
        {
            int count = Data.Count();
            Store store = this.GridPanel1.GetStore();
            store.DataSource = Data.Skip(startindex * limit).Take(limit);
            store.DataBind();
            this.GridPanel1.Show();
        }
    
    
        protected partial class TestData
        {
            public double Item1 { get; set; }
            public double Item2 { get; set; }
            public double Item3 { get; set; }
            public double Item4 { get; set; }
        }
    
        protected List<TestData> Data
        {
            get
            {
                List<TestData> list = new List<TestData>();
                for (int i = 0; i < 100; i++)
                {
                    list.Add(new TestData() { Item1 = i, Item2 = i, Item3 = i, Item4 = i });
                }
                return list;
            }
        }
    </script>
    
    <!DOCTYPE html>
    
    <html>
    <head id="Head1" runat="server">
        <title>Simple Array Grid - Ext.NET Examples</title>
        <link href="/resources/css/examples.css" rel="stylesheet" />
    
        <script>
            var template = '<span style="color:{0};">{1}</span>';
    
            var change = function (value) {
                return Ext.String.format(template, (value > 0) ? "green" : "red", value);
            };
    
            var pctChange = function (value) {
                return Ext.String.format(template, (value > 0) ? "green" : "red", value + "%");
            };
        </script>
    </head>
    <body>
        <form id="Form1" runat="server">
            <ext:ResourceManager ID="ResourceManager1" runat="server" />
    
            <ext:Panel ID="Panel1"
                runat="server"
                Title="Example" Visible="true"
                Width="600"
                Height="350"
                Layout="FitLayout">
                <TopBar>
                    <ext:Toolbar ID="Toolbar1" runat="server">
                        <Items>
                            <ext:Button ID="Button1" runat="server" Text="Load Data" OnDirectClick="Button1_Click" />
                        </Items>
                    </ext:Toolbar>
                </TopBar>
                <Items>
                    <ext:GridPanel
                        ID="GridPanel1"
                        runat="server"
                        Hidden="true"
                        Border="false">
                        <Store>
                            <ext:Store ID="Store1" runat="server" AutoLoad="false" RemoteSort="true" RemotePaging="true">
                                <AutoLoadParams>
                                    <ext:Parameter Name="start" Value="0" Mode="Raw" />
                                    <ext:Parameter Name="limit" Value="10" Mode="Raw" />
                                </AutoLoadParams>
                                <Model>
                                    <ext:Model ID="Model1" runat="server">
                                        <Fields>
                                            <ext:ModelField Name="Item1" Type="Float" />
                                            <ext:ModelField Name="Item2" Type="Float" />
                                            <ext:ModelField Name="Item3" Type="Float" />
                                            <ext:ModelField Name="Item4" Type="Float" />
                                        </Fields>
                                    </ext:Model>
                                </Model>
                                <Proxy>
                                    <ext:PageProxy />
                                </Proxy>
                            </ext:Store>
                        </Store>
                        <ColumnModel ID="ColumnModel1" runat="server">
                            <Columns>
                                <ext:Column ID="Column1" runat="server" Text="Item 1" DataIndex="Item1">
                                </ext:Column>
                                <ext:Column ID="Column2" runat="server" Text="Item 2" DataIndex="Item2">
                                </ext:Column>
                                <ext:Column ID="Column3" runat="server" Text="Item 3" DataIndex="Item3">
                                </ext:Column>
                                <ext:Column ID="Column4" runat="server" Text="Item 4" DataIndex="Item4">
                                </ext:Column>
                            </Columns>
                        </ColumnModel>
                        <SelectionModel>
                            <ext:RowSelectionModel ID="RowSelectionModel1" runat="server" Mode="Single" />
                        </SelectionModel>
                        <BottomBar>
                            <ext:PagingToolbar ID="PagingToolbar1"
                                runat="server"
                                DisplayInfo="true"
                                DisplayMsg="Displaying properties {0} - {1} of {2}"
                                EmptyMsg="No properties to display" />
                        </BottomBar>
                    </ext:GridPanel>
                </Items>
            </ext:Panel>
        </form>
    </body>
    </html>
  6. #6
    If you use PageProxy then you have to define OnReadData event handler and bind data in that handler
    Please see
    https://examples2.ext.net/#/GridPane..._Sorting/Page/
  7. #7
    Quote Originally Posted by asiaesolutions View Post
    Because the data over 300k records with many filter parameter so I want to fully control it than any autoway. If can control it like the original asp.net gridview is better.
    Also we are not sure what you mean here. Please clarify.
  8. #8
    Please refer to the attachment file, it my design. The run flow is the user select the filter option on the form then click the Search button and the gridpanel will appear and display the result. The grid display 20 record per page, my search function will return the 20 rows and the total page after query.

    1 - If I not use proxy, use search button to bound the result data to gridpanel store manual. The databind but I can't set the total page to the grid.
    2 - If I set PageProxy in the gridpanel, after click the button to bind data manual, it got record but can't bind to gridpanel(mean blank grid with 0 record).

    If I do the first way, is there any way to set the total page to grid and do the remote paging(the search form allow 2 level sorting) and sorting.
    If I choose the second way, I must implement the OnReadData to do refresh and remote sorting and paging. If like that the OnReadData got the code to requery and paging and sorting inside. Is there any way to trigger the grid load data by the Search button and got the separate event for sorting and paging(mean like original asp.net gridview got 2 event OnSorting and OnPaging).

    Click image for larger version. 

Name:	10-Jan-13 1-49-21 PM.jpg 
Views:	103 
Size:	70.1 KB 
ID:	5407
  9. #9
    When you click Search button then you have to call the following handler instead direct event
    Handler="Store1.load();"
    In this case, OnReadData handler will be called, you can apply own filtering, paging and etc in that code and return total count
  10. #10
    Also you have to set RemoteSort="true" for the store
    In this case, sorting will trigger OnReadData also
Page 1 of 2 12 LastLast

Similar Threads

  1. [CLOSED] Append a fully loaded child in a remote TreePanel
    By RCN in forum 2.x Legacy Premium Help
    Replies: 4
    Last Post: May 30, 2012, 12:23 PM
  2. [CLOSED] [1.0] TreeGridColumn Doesnt Fully Expand
    By MP in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Nov 17, 2010, 1:27 PM
  3. Replies: 6
    Last Post: Feb 25, 2010, 7:22 PM
  4. Replies: 0
    Last Post: Dec 01, 2009, 2:45 AM
  5. Replies: 1
    Last Post: Nov 01, 2009, 6:08 AM

Posting Permissions