PDA

View Full Version : Add to pagingtoolbar - > dynamic pageResizer.



shakerkk
23 Sep 2014, 1:47 AM
I just want to ask if exists dynamic pageResizer without using plugin for pagingtoolbar , and somehow add as an item directly in pagingtoolbar ?

scottmartin
23 Sep 2014, 5:34 AM
See this thread for adding items:
http://www.sencha.com/forum/showthread.php?292040

scottmartin
23 Sep 2014, 5:37 AM
Ah, I see this was you :)

What you would need to do is create your own plugin or a class and use that xtype instead of a default

So

Ext.Define('MyPagingCombo', {
xtype : 'my-paging-combo',
});


Then add that xtype to the pagingtoolbar as mentioned in the other thread.

shakerkk
23 Sep 2014, 6:05 AM
Yes i did something like :



Ext.define('aw.grid.PageLimit',{
extend: 'Ext.form.field.ComboBox',
alias: 'plugin.pagesize',
mode: 'local',
displayField: 'text',
valueField: 'value',
allowBlank: false,
triggerAction: 'all',
editable: false,
width: 50,
maskRe: /[0-9]/,
/** * initialize the paging combo after the pagebar is randered */
init: function (paging) { paging.on('afterrender', this.onInitView, this); },
/** * create a local store for availabe range of pages */
store: ['5','10','15','25'],
/** * assing the select and specialkey events for the combobox * after the pagebar is rendered. * searching for tbfill and replace with combo box paging */
onInitView: function (paging) {
this.setValue(paging.store.pageSize);//
searching for tbfill position and replace with combo box paging
for (var i = 0; i < paging.items.length; i++) {
if (paging.items.items[i].xtype == 'tbfill') {
paging.remove(paging.items.items[i]);
paging.add(i,this);
paging.add(i+2," 2 - Rows are selected
") } }
this.on('select', this.onPageSizeChanged, paging);
this.on('specialkey', function (combo, e) {
if (13 === e.getKey()) { this.onPageSizeChanged.call(paging, this); } }); }, /** * refresh the page when the value is changed */ onPageSizeChanged: function (combo) { this.store.pageSize = parseInt(combo.getRawValue(), 10); this.doRefresh(); }}); And i added here :

Ext.define('aw.grid.PagingToolbar', {
extend: 'Ext.toolbar.Paging',
alias: 'widget.custompaging',
requires: ['aw.grid.PageLimit'],
displayInfo: true,
plugins: 'pagesize'});
after that i put in my Grid.js like this:


dockedItems: [
{
xtype: 'custompaging',
dock: 'bottom',
displayInfo: true
} ]

But i`m asking if is somehow possible to make this easyer or simpler ...beacuse i have to add to my pagingtoolbar a field where its shows me "How many Rows in grid are selected" when i select them beacuse i have rows with checkboxes, sorry for my english i hope you understand what i`m saying ..:-?

scottmartin
23 Sep 2014, 6:23 AM
But i`m asking if is somehow possible to make this easyer or simpler

There is no built in method if that is what you are asking for.

The options mentioned above are the correct approach.

Scott.

shakerkk
23 Sep 2014, 6:27 AM
Thanks for your answer i wasn't sure if i did it correct and optimal .