Hybrid View

  1. #1
    Sencha Developer
    Join Date
    Mar 2007
    Location
    Germany
    Posts
    482
    Vote Rating
    1
    Wolfgang is on a distinguished road

      0  

    Default get/set PageSize for Ext.PagingToolbar?

    get/set PageSize for Ext.PagingToolbar?


    Although that can be done in the beforeload event etc, I think get/set methods for pageSize in PagingToolbar would be great to allow setting the pageSize dynamically.
    Alternativly, I also thought of pageSize being an "official" property.

    Regards

    Wolfgang

  2. #2
    Sencha - Community Support Team mystix's Avatar
    Join Date
    Mar 2007
    Location
    Singapore
    Posts
    6,236
    Vote Rating
    5
    mystix will become famous soon enough

      0  

    Default


    isn't pageSize already an official config?

    you can already do this currently
    Code:
    var paging = new Ext.PagingToolbar(gridFoot, ds, { // add a paging toolbar to the grid's footer
      pageSize: 20,
      displayInfo: true,
      displayMsg: 'Displaying Sequences {0} - {1} of {2}',
      emptyMsg: "No Sequences to display"
    });
    or am i missing something?

  3. #3
    Sencha Developer
    Join Date
    Mar 2007
    Location
    Germany
    Posts
    482
    Vote Rating
    1
    Wolfgang is on a distinguished road

      0  

    Default


    Well i thought of get/set during _runtime_ do force a recalculating of the limit param.
    Example: i resize my grid and want to get onyl 7 records, instead of the default 20.
    Later i resize again and want 15 records instead of 7.

    When using the 'beforeload' event, i can pass params / baseParams like start / limit directly.
    But if i change pageSize, i would need to access at least one time the pagebar to let the pagebar recalculate the new value for limit or use a workaround like this:
    PHP Code:
    pageSize.on('change', function() {
                    
    pageBar.pageSize parseInt(pageSize.getValue());
                    
    ds.load({params: {start0limitpageBar.pageSize}});
                }); 
    So i thought of a method setPageSize(newValue) that would not only set pageSize but also adjust the value for limit for any new load request.

  4. #4
    Ext User
    Join Date
    Jul 2007
    Posts
    20
    Vote Rating
    0
    lychorojostone is on a distinguished road

      0  

    Default


    I Had the same problem... did you solve it???
    Lisandro

  5. #5
    Sencha User
    Join Date
    Apr 2011
    Posts
    1
    Vote Rating
    0
    neketsushonen is on a distinguished road

      0  

    Default You should do this

    You should do this


    Hey Friend:

    I guess you should fire your event from "store", and not from "page".

    //this.getValue() => the page size you want

    store.load({params:{start:0, limit:this.getValue()}});
    Ext.getCmp("pagBarCliente").pageSize=this.getValue();

    After change the store from the grid, and you set pageSize, the panel will show you the correct count of pages.