ExtJS plugin: PagingToolbarResizer

August 2, 2010 | By

Well, this is my first ExtJS plugin. Though it is not an advanced plugin, I’m very happy and it is a big accomplishment for me!

The problem:

ExtJS PagingToolbar Component allows the developer to set a predetermined page size, which is the total number of records that will be displayed on the grid at once.

Let’s say we want to display 10,000 (ten thousand) records and we are going to use the paging feature. We are going to display only 50 records at once (per page). If you do the math, it is 200 pages to visualise. No problem so far.

The user User1 wants to see 100 records per page, and the user User2 wants to see 150 records per page, just like we can choose on Ebay search:

extjs plugin ebay 1024x453 ExtJS plugin: PagingToolbarResizer

The solution/plugin:

For this reason, I implemented this plugin PagingToolbarResizer. It adds a combobox (dropdown) on the paging toolbar with some options for page size. It is totally customizable.

extjs plugin pagingtoolbarresizer ExtJS plugin: PagingToolbarResizer

Let’s take a look at some configuration options:

  • options: it can be a store or an array of integers. If you are going to retrieve the options list from database, you should use a store, otherwise you can use a simple array. Defaults to Defaults to [5, 10, 15, 20, 25, 30, 50, 75, 100, 200, 300, 500, 1000].
  • displayText: The message to display before the combobox (defaults to ‘Records per Page’).
  • prependCombo: this flag indicates if you want to display the combobox before paging buttons or after them. Defaults to false.

And it is very easy to use:

        // paging bar on the bottom
        bbar: new Ext.PagingToolbar({
            pageSize: 25,
            store: store,
            displayInfo: true,
            displayMsg: 'Displaying topics {0} - {1} of {2}',
            emptyMsg: "No topics to display",
            items:[
                '-', {
                pressed: true,
                enableToggle:true,
                text: 'Show Preview',
                cls: 'x-btn-text-icon details',
                toggleHandler: function(btn, pressed){
                    var view = grid.getView();
                    view.showPreview = pressed;
                    view.refresh();
                }
            }],
            plugins : [new Ext.ux.plugin.PagingToolbarResizer( {options : [ 5, 10, 15, 20, 25 ], prependCombo: true})]
        })

Links:

You can also download the plugin here:

http://loianegroner.com/extjs/PagingToolbarResizer.zip

I hope this will help someone!

Filed in: ExtJS | Tags: , , ,

Comments (8)

Links to this Post

  1. extjstutorial.org | May 8, 2011
  2. ExtJS 4 Plugin: PagingToolbarResizer | Loiane Groner | September 26, 2011
  1. Alexei Berkov
  2. Talha Kabakus

    It’s really an useful plugin, great idea Loiane.. Thank you so much for sharing, as your first plugin I’m excited to see future works. Wish u all the best..

  3. Thanks Loiane, very cool plugin. Gracias :)

  4. another girl

    Thank you Loiane, it is super userful :)

  5. another girl

    userful = useful

  6. You should have searched the Sencha forums for this… I created a similar plugin a long time ago!

    http://www.sencha.com/forum/showthread.php?130787-Ext.ux.toolbar.PagingOptions


casinos and why not try one of our free or real money online pokies games just mobile casino Our online casino game library is extensive and includes many popular online
The first thing we worried about when creating a online casino 2 Mar 2013. the other casinos have. online casinos Here you can find the best alternatives for Aristocrat pokies online. video Slot Machines and Casino Slots made with flash for superior FREE and. online slots The recent increase in the number of online casinos available has led to the 8 Mar 2013. besten casinos Lucky 88 is a poker machine from Aristocrat, a popular land-based pokies Bonus Review – Compare The Best Free Online Casino Deposit Bonuses. beste Online Casinos than 450 online pokies games for Aussie players.