[CLOSED] How to get record count from the grid panel

  1. #1

    [CLOSED] How to get record count from the grid panel

    Hi....

    im using coolite0.8.1.987, in my application i required to get number of records count in grid panel(not in paging toolbar)..i need code for this ...
    Last edited by Daniil; Jan 09, 2011 at 12:07 PM. Reason: [CLOSED]
  2. #2
    Hi,

    Please use the following code:

    Example
    GridPanel1.getStore().getTotalCount()
  3. #3
    Quote Originally Posted by Daniil View Post
    Hi,

    Please use the following code:

    Example
    GridPanel1.getStore().getTotalCount()
    we haven't found getStore() option..we found the follwing options

    GetCustomResourceAttributes
    GetHashCode
    GetRouteUrl
    GetScripts
    GetStyles
    GetThemes
    GetType
    GetUniqueIDRelativeTos
  4. #4
    Quote Originally Posted by Vasudhaika View Post
    we haven't found getStore() option..we found the follwing options

    GetCustomResourceAttributes
    GetHashCode
    GetRouteUrl
    GetScripts
    GetStyles
    GetThemes
    GetType
    GetUniqueIDRelativeTos
    These are all server-side Methods.

    The code post above by Daniil is client-side JavaScript code.
    Geoffrey McGill
    Founder
  5. #5
    Hi Vasudhaika,

    Now I see that you need total count on server side. Well, the best way is sending this value as extra parameter of AjaxEvent.

    Example
    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
    
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Ext.IsAjaxRequest)
            {
                this.Store1.DataSource = new object[] 
                {
                    new object[] {"test1"},
                    new object[] {"test2"},
                    new object[] {"test3"},
                    new object[] {"test4"},
                    new object[] {"test5"},
                    new object[] {"test6"},
                    new object[] {"test7"},
                    new object[] {"test8"},
                    new object[] {"test9"}
                };
                this.Store1.DataBind();
            }
        }
    
        protected void Button_Click(object sender, AjaxEventArgs e)
        {
            int totalCount = int.Parse(e.ExtraParams["totalCount"]);
            Ext.Msg.Alert("Total count", totalCount.ToString()).Show();
        }
    </script>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>Coolite 0.8.X Example</title>
    </head>
    <body>
        <form runat="server">
        <ext:ScriptManager runat="server" />
        <ext:Store ID="Store1" runat="server">
            <Reader>
                <ext:ArrayReader>
                    <Fields>
                        <ext:RecordField Name="test" />
                    </Fields>
                </ext:ArrayReader>
            </Reader>
        </ext:Store>
        <ext:GridPanel 
            ID="GridPanel1" 
            runat="server" 
            StoreID="Store1" 
            AutoHeight="true">
            <ColumnModel runat="server">
                <Columns>
                    <ext:Column Header="Test" DataIndex="test" />
                </Columns>
            </ColumnModel>
            <BottomBar>
                <ext:PagingToolbar runat="server" PageSize="3" />
            </BottomBar>
        </ext:GridPanel>
        <ext:Button runat="server" Text="Get total count">
            <AjaxEvents>
                <Click OnEvent="Button_Click">
                    <ExtraParams>
                        <ext:Parameter 
                            Name="totalCount" 
                            Value="GridPanel1.getStore().getTotalCount()" 
                            Mode="Raw" />
                    </ExtraParams>
                </Click>
            </AjaxEvents>
        </ext:Button>
        </form>
    </body>
    </html>

Similar Threads

  1. Missing first record in Grid Panel
    By dkroy in forum 1.x Help
    Replies: 1
    Last Post: Oct 01, 2013, 3:58 AM
  2. [CLOSED] Get record count
    By Antonio09 in forum 2.x Legacy Premium Help
    Replies: 1
    Last Post: Aug 16, 2012, 5:47 AM
  3. [CLOSED] Group Count in Grid Panel along with paging (0.8.3)
    By vedagopal2004 in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Nov 24, 2010, 7:20 AM
  4. [CLOSED] Problem with grid panel record change?
    By Etisbew in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: Oct 27, 2009, 8:48 AM
  5. Gridpanel record count
    By ram in forum 1.x Help
    Replies: 0
    Last Post: Nov 13, 2008, 6:50 AM

Posting Permissions