GridPanel Paging

  1. #1

    GridPanel Paging

    Hi !

    I use a static ajax method to return a structure "data" like this :
      data.totalCount = xx // The max number of rows returned by my query (100 for example)
      data.results= xx // the exact rows (sorted and limited by the limit value) (10 for example)
    On the success method I use the loadData of the store to bind the data like this :
      var data = eval('data');
      myStore.loadData(data);
    I see in javascript the value of myStore.totalLength = 100 (for example)
    But when I do myStore.getTotalCount() = 10 (the exact number of the returned rows)

    So the paging does not work. It is blocked to the 10 first rows of the first page.
    I don't see the other pages...

    How can I resolve my problem ?

    Thanks...
  2. #2

    RE: GridPanel Paging

    Hi,

    Please provide test sample
  3. #3

    RE: GridPanel Paging

    Here a sample :

    First in a js page, I call this method :
    Coolite.AjaxMethods.BindGrid({
          success: function(result) {
            myData = eval("(" + result + ")");
            stData.loadData(myData.Results);
            // stData.totalLength returns 100 element (great!)
            // stData.getTotalCount() returns only 10 elements :-(
          },
    
          failure: function(errorMsg) {
            showError(errorMsg);
          }
        });
    In code behind, I have this method :
        [Cool.AjaxMethod]
        public static string BindFiles()
        {
            // Some code...
            // ...
            PagingStruct myData = new PagingStruct();
            myData.Results = GetData(); // this method returns a List<myObject>
            myData.TotalCount = GetTotalCount(); // this method returns the total rows of my query (100 in this example)
            return Cool.JSON.Serialize(myData);
        }
    Ok, now in my Form.aspx :
      <ext:Store ID="stData" runat="server" SerializationMode="Complex" DirtyWarningText="false">
        <AutoLoadParams>
          <ext:Parameter Name="start" Value="0" Mode="Raw" Encode="False" />
          <ext:Parameter Name="limit" Value="10" Mode="Raw" Encode="False" />
        </AutoLoadParams>
        <Reader>
          <ext:JsonReader ReaderID="ObjID" TotalProperty="TotalCount" Root="Results">
          ...
        </Reader>
      </ext:store>
    
      <ext:GridPanel ud="grdMain" runat="server" ...>
        <ColumnModel ...>
        ...
        </ColumnModel>
        <ext:PagingToolbar ID="tbPaging" runat="server" StoreID="stData" DisplayInfo="True" DisplayMsg="Documents {0} - {1} de {2}" PageSize="10">
        </ext:PagingToolbar>
      </ext:GridPanel>
    My problem is that I can't use the paging toolbar because if I do a breakpoint in javascript just after the loadData method, I have stData.totalLength = 100 (the max number of rows) but stData.getTotalCount() = 10 (the exact number of returned rows)

    The other problem is in the sortGrid event of the GridPanel.
    At the begining of the method, the stData.items.data.length = 0 !
    As if it cleared the data just before entering the method...

    Thank you for your help !
  4. #4

    RE: GridPanel Paging

    Hello !

    In fact how can I provide the total number of rows returned by the query.
    If I use a structure like this :
    class PagingStruct
    {
      public List<MyObject> Results;
      public int TotalCount;
    }
    If in code behind in my StaticAjax method I set up the Resturns and TotalCount variables, in javascript, I have the TotalCount = exact rows returned by my query (not the total).

    How can I set the paging with this method ?

    Thank you...

Similar Threads

  1. GridPanel grouping and paging
    By milenios in forum 2.x Help
    Replies: 4
    Last Post: Aug 13, 2012, 9:14 PM
  2. Gridpanel paging bug
    By kakagu in forum 1.x Help
    Replies: 2
    Last Post: Apr 07, 2012, 1:31 PM
  3. GridPanel Paging with PageProxy
    By jigpatel06 in forum 1.x Help
    Replies: 3
    Last Post: Mar 11, 2011, 10:33 AM
  4. Paging in GridPanel
    By Rakeshkumar.a in forum 1.x Help
    Replies: 1
    Last Post: Nov 29, 2010, 4:54 PM
  5. Paging GridPanel
    By marcmvc in forum 1.x Help
    Replies: 2
    Last Post: Jul 21, 2010, 10:28 PM

Posting Permissions