1. #11
    Sencha User
    Join Date
    Nov 2011
    Location
    India
    Posts
    83
    Vote Rating
    0
    Answers
    1
    Rajat Sharma is on a distinguished road

      0  

    Post


    Thanks for those very comprehensive solutions.
    JSON returned from server is an object now in the suggested format.

    Code:
    {"success":true,"total":75,"data":[{"name":"testdev02"},{"name":"mobile03"},{"name":"glsextusr17"}.....]}
    The server side code is sending 10 records. Actually it is sending the number of records after "interpreting the parameters start, limit". The test client for it at server side where I manually use start and limit values in range of 10 such as 0,10 or 10,20 (format is start, limit), works well and always prints 10 records JSON.

    However, while hitting from client, the following happens.
    1st request - grid: 10 records - server log values start 0, limit 10, page 1
    next page click - grid: 25 records - server log values start: 25, limit:25, page 2
    next page click - grid: 25 records - server log values start: 50, limit:25, page 3

    Only in 1st loading of grid , are the configured values for start and limit used. Earlier I thought that the values may be getting distorted because may be I am returning more than 10 records but the testclient (where i explicitly give values in range of 10) is ok.

    Where could the values be changing for start and limit. Any suggestions.

    In all the cases, the bottom of paging toolbar shows something like
    Page 1 (or 2 or 3) of 3 Displaying 25-50 of 75
    It seems the grid is hell bent in showing the results in sets of 3. The server side code is correct as per my knowledge. Here is the interface:
    Code:
    public JSONObject getUserJSON(int startIndex,int limit)
    It is correctly returning values between start and limit. But the values themselves are getting changed after intial load. As evident from checking logs.
    Where I am i going wrong ? Anything wrongly configured in grid ?

  2. #12
    Sencha User
    Join Date
    Nov 2011
    Location
    India
    Posts
    83
    Vote Rating
    0
    Answers
    1
    Rajat Sharma is on a distinguished road

      0  

    Default


    Got it !

    There is a pageSize config for Ext.data.Store, which unless explicitly set, defaults to (not surprisingly) 25. Overrode it explicitly and all seems well now.
    The key then, to paging I guess is to know that the server sends request something like:
    Code:
    ActionServlet?task=userList&page=1&start=0&limit=10&...
    This is an important detail and very helpful in returning appropriate (number) records from server. I feel it is missing from API docs. If anyone feels otherwise, please poit out.