1. #1
    Sencha User
    Join Date
    Mar 2011
    Posts
    49
    Vote Rating
    0
    kirankumar1231 is on a distinguished road

      0  

    Default paging problem in extjs grid

    paging problem in extjs grid


    hello experts,

    i am loading 10 recors per page
    i am requesting the staart and limit params through my java code and using that i have written a sql query like this
    Code:
    String sql="select * from employee limit '"+limit+"' offset '"+start+"'";
    
    but when i click on the next button next request is not hitting the server

    but when i request all the records from my db next button is working fine but showing up all the records

    this is the extjs code what i have written
    Code:
    <
    scripttype="text/javascript">
    Ext.onReady(
    function() { Ext.QuickTips.init(); var reader=new Ext.data.JsonReader({ },[ {name: 'empid',mapping:'empid'}, {name: 'empname'} ] ); var store=new Ext.data.Store({ root:'employee', remoteSort:true, proxy : new Ext.data.HttpProxy({ url: 'get.json', method:'GET'
    }), reader:reader });
    var colModel = new Ext.grid.ColumnModel([ {header: "empid", width: 120, sortable: true, dataIndex: "empid"}, {header: "empname", width: 90, sortable: true, dataIndex: "empname"} ]); var paging=new Ext.PagingToolbar({ pageSize:20, store: store, displayInfo: true, displayMsg: 'Displaying topics {0} - {1} of {2}', emptyMsg: "No topics to display"
    });
    var grid = new Ext.grid.GridPanel({ height:200, title:'employee details', width:600, store:store, cm: colModel, bbar:paging, remoteSort:true
    }); store.load({params:{start:0,limit:20}}); grid.render(document.body); });
    </script>
    let me know what could be the problem
    i am a new bie to this extjs

  2. #2
    Sencha User brittongr's Avatar
    Join Date
    Jun 2007
    Location
    Panama
    Posts
    109
    Vote Rating
    3
    brittongr is on a distinguished road

      0  

    Default


    Uhmmm... you said you are loading 10 record per page but in your code you have setup 20 records as page size in PagingToolbar and load 20 records in first load...
    Greivin Britton

    My Extensions:
    Ext.ux.NumericField: Number field with support for currencySymbol, thousand separator, international...
    Ext.ux.PagerSizeSelector: A plugin that allows the change page size with just one click.
    Ext.ux.FieldAccess: A plugin to let the user know which fields are editable.

  3. #3
    Sencha User
    Join Date
    Mar 2011
    Posts
    49
    Vote Rating
    0
    kirankumar1231 is on a distinguished road

      0  

    Default


    even if it is 20 recs per page i could not get the next button to work

  4. #4
    Sencha User brittongr's Avatar
    Join Date
    Jun 2007
    Location
    Panama
    Posts
    109
    Vote Rating
    3
    brittongr is on a distinguished road

      0  

    Default


    what are you returning as totalCount? What is the value of tha property?
    Greivin Britton

    My Extensions:
    Ext.ux.NumericField: Number field with support for currencySymbol, thousand separator, international...
    Ext.ux.PagerSizeSelector: A plugin that allows the change page size with just one click.
    Ext.ux.FieldAccess: A plugin to let the user know which fields are editable.

  5. #5
    Sencha User brittongr's Avatar
    Join Date
    Jun 2007
    Location
    Panama
    Posts
    109
    Vote Rating
    3
    brittongr is on a distinguished road

      0  

    Default


    If you post the params of the request and the response of the first request maybe i can help you...
    Greivin Britton

    My Extensions:
    Ext.ux.NumericField: Number field with support for currencySymbol, thousand separator, international...
    Ext.ux.PagerSizeSelector: A plugin that allows the change page size with just one click.
    Ext.ux.FieldAccess: A plugin to let the user know which fields are editable.

  6. #6
    Sencha User
    Join Date
    Mar 2011
    Posts
    49
    Vote Rating
    0
    kirankumar1231 is on a distinguished road

      0  

    Default


    i am not using total count property

  7. #7
    Sencha User
    Join Date
    Mar 2011
    Posts
    49
    Vote Rating
    0
    kirankumar1231 is on a distinguished road

      0  

    Default


    this is my simple json structure

    [{"empid":1231,"empname":"kiran kumar"}]

  8. #8
    Sencha User brittongr's Avatar
    Join Date
    Jun 2007
    Location
    Panama
    Posts
    109
    Vote Rating
    3
    brittongr is on a distinguished road

      0  

    Default


    This is how i setup my store:

    Code:
     var dsEntity = new Ext.data.JsonStore(
        {
            url: url,
            root: 'data',
            totalProperty: 'totalCount',
            id: idProperty,
            fields: fields,
            remoteSort: true,
            sortInfo: 
            {
                field: "FullName",
                direction: "ASC"
            }
        });
    The response looks like this:

    Code:
    {"success":true,"totalCount":20,"data":[{"AddressCountry":null,"AddressCountryId":null}]}
    So if you have 100 records in your database table you should have 5 pages at your paging toolbar. But with totalCount property paging could know how much records are in total.
    Last edited by brittongr; 28 Mar 2011 at 10:20 PM. Reason: added complete response
    Greivin Britton

    My Extensions:
    Ext.ux.NumericField: Number field with support for currencySymbol, thousand separator, international...
    Ext.ux.PagerSizeSelector: A plugin that allows the change page size with just one click.
    Ext.ux.FieldAccess: A plugin to let the user know which fields are editable.

  9. #9
    Sencha User
    Join Date
    Mar 2011
    Posts
    49
    Vote Rating
    0
    kirankumar1231 is on a distinguished road

      0  

    Default


    so i need to restructure my json object and put a total property and let the grid know what is the total count coming from the server?

  10. #10
    Sencha User brittongr's Avatar
    Join Date
    Jun 2007
    Location
    Panama
    Posts
    109
    Vote Rating
    3
    brittongr is on a distinguished road

      0  

    Default


    Yes, because you are loading remote data, check at the response object that i returning, i updated what i posted so you can look the complete structure.
    Greivin Britton

    My Extensions:
    Ext.ux.NumericField: Number field with support for currencySymbol, thousand separator, international...
    Ext.ux.PagerSizeSelector: A plugin that allows the change page size with just one click.
    Ext.ux.FieldAccess: A plugin to let the user know which fields are editable.

Similar Threads

  1. Need to remove the Refresh button in the Paging Toolbar of ExtJs grid.
    By spothineni in forum Ext 1.x: Help & Discussion
    Replies: 4
    Last Post: 23 May 2011, 11:08 PM
  2. EXTJS 2.0 paging problem..PLease help!!!!!
    By bhartibhat in forum Ext 2.x: Help & Discussion
    Replies: 4
    Last Post: 28 Apr 2010, 6:08 AM
  3. Extjs Editable Grid with grouping and paging
    By riddhibhatia in forum Ext 3.x: Help & Discussion
    Replies: 6
    Last Post: 30 Apr 2009, 8:08 PM
  4. ext gwt vs extjs 2.0 grid paging
    By WBarnie in forum Ext GWT: Help & Discussion (1.x)
    Replies: 1
    Last Post: 28 Apr 2009, 4:58 AM
  5. Help - Paging for Grid (Extjs 2.2)
    By shankys_4u in forum Ext 2.x: Help & Discussion
    Replies: 20
    Last Post: 17 Feb 2009, 12:19 AM

Thread Participants: 1

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar