galdaka
28 Apr 2009, 2:51 AM
Hi,
I write a new PageSizer plugin for new rewrited Ext.toolbar component.
I use Ext.ux.iconMgr If you dont´t want to use this, please create iconCls css class with attached images.
28/04/2009: First version.
29/04/2009: Rewrite. Felixibilize the plugin and support locale.
30/04/2009: Capture http://www.jadacosta.es/contents/screencast/capture1.swf
02/06/2009: Minor change "pagingToolbar.insert(12, '-');" for last rev of ExtJS 3.0
15/06/2009: Added GNU license.
11/08/2009: Fixed some bugs. Added price: 18€. In a pack with AutoRefresher (http://extjs.com/forum/showthread.php?p=322663#post322663) is offered for 30€. Contact to: galdaka@hotmail.com
03/11/2009: License changed. Reason: People use your work for comercial purposes without your permission.
03/11/2009: NEW LICENSE: http://creativecommons.org/licenses/by-nc/3.0/ (http://creativecommons.org/licenses/by-nc/3.0/). Thanks to cparker (http://www.extjs.com/forum/member.php?u=57967).
/**
* Ext.ux.grid.PageSizer
* Copyright (c) 2009-2010, José Alfonso Dacosta Dominguez (galdaka@hotmail.com)
*
* Ext.ux.grid.PageSizer is licensed http://creativecommons.org/licenses/by-nc/3.0/ license.
*
* Commercial use is prohibited. contact with galdaka@hotmail.com
* if you need to obtain a commercial license.
*
* Site: www.jadacosta.es
*/
Ext.namespace('Ext.ux.grid');
Ext.ux.grid.PageSizer = Ext.extend(Ext.CycleButton, {
initialSize: this.initialSize || 15,
pageSizes: this.pageSizes || [10, 15, 20, 25, 30, 50, 75, 100],
addText: ' entrada(s) por página',
initComponent: function(){
var ir=[];
var at = this.addText ;
var is = this.initialSize;
Ext.each(this.pageSizes, function(ps){ir.push({
text: ' ' + ps + at,
value: ps,
checked: ps==is ? true : false
})
});
Ext.apply(this, {
showText: true,
prependText: ' ',
forceIcon: Ext.ux.iconMgr.getIcon('/dev/common/icons.nsf/extjs/ux/icons/', 'table_add_del_rows'),
items: ir
});
Ext.ux.grid.PageSizer.superclass.initComponent.apply(this, arguments);
},
init: function(pagingToolbar) {
pagingToolbar.on('render', this.onInitView, this);
},
onInitView: function(pagingToolbar) {
pagingToolbar.insert(12, this);
pagingToolbar.insert(12, '-');
this.on('change', this.onPageSizeChanged, pagingToolbar);
},
onPageSizeChanged: function(cycleButton) {
this.pageSize = parseInt(cycleButton.getActiveItem().value);
this.doLoad(0);
}
});
if(Ext.ux.grid.PageSizer){
Ext.ux.grid.PageSizer.prototype.addText = " entrada(s) por página";
}
Be careful::
*) Change Ext.ux.iconMgr.getIcon('/dev/common/icons.nsf/extjs/ux/icons/', 'application_view_list_1') for css class like this:
.myImg01{ background-image: url({your-url/application_view_list_1}) !important; };
Greetings,
I write a new PageSizer plugin for new rewrited Ext.toolbar component.
I use Ext.ux.iconMgr If you dont´t want to use this, please create iconCls css class with attached images.
28/04/2009: First version.
29/04/2009: Rewrite. Felixibilize the plugin and support locale.
30/04/2009: Capture http://www.jadacosta.es/contents/screencast/capture1.swf
02/06/2009: Minor change "pagingToolbar.insert(12, '-');" for last rev of ExtJS 3.0
15/06/2009: Added GNU license.
11/08/2009: Fixed some bugs. Added price: 18€. In a pack with AutoRefresher (http://extjs.com/forum/showthread.php?p=322663#post322663) is offered for 30€. Contact to: galdaka@hotmail.com
03/11/2009: License changed. Reason: People use your work for comercial purposes without your permission.
03/11/2009: NEW LICENSE: http://creativecommons.org/licenses/by-nc/3.0/ (http://creativecommons.org/licenses/by-nc/3.0/). Thanks to cparker (http://www.extjs.com/forum/member.php?u=57967).
/**
* Ext.ux.grid.PageSizer
* Copyright (c) 2009-2010, José Alfonso Dacosta Dominguez (galdaka@hotmail.com)
*
* Ext.ux.grid.PageSizer is licensed http://creativecommons.org/licenses/by-nc/3.0/ license.
*
* Commercial use is prohibited. contact with galdaka@hotmail.com
* if you need to obtain a commercial license.
*
* Site: www.jadacosta.es
*/
Ext.namespace('Ext.ux.grid');
Ext.ux.grid.PageSizer = Ext.extend(Ext.CycleButton, {
initialSize: this.initialSize || 15,
pageSizes: this.pageSizes || [10, 15, 20, 25, 30, 50, 75, 100],
addText: ' entrada(s) por página',
initComponent: function(){
var ir=[];
var at = this.addText ;
var is = this.initialSize;
Ext.each(this.pageSizes, function(ps){ir.push({
text: ' ' + ps + at,
value: ps,
checked: ps==is ? true : false
})
});
Ext.apply(this, {
showText: true,
prependText: ' ',
forceIcon: Ext.ux.iconMgr.getIcon('/dev/common/icons.nsf/extjs/ux/icons/', 'table_add_del_rows'),
items: ir
});
Ext.ux.grid.PageSizer.superclass.initComponent.apply(this, arguments);
},
init: function(pagingToolbar) {
pagingToolbar.on('render', this.onInitView, this);
},
onInitView: function(pagingToolbar) {
pagingToolbar.insert(12, this);
pagingToolbar.insert(12, '-');
this.on('change', this.onPageSizeChanged, pagingToolbar);
},
onPageSizeChanged: function(cycleButton) {
this.pageSize = parseInt(cycleButton.getActiveItem().value);
this.doLoad(0);
}
});
if(Ext.ux.grid.PageSizer){
Ext.ux.grid.PageSizer.prototype.addText = " entrada(s) por página";
}
Be careful::
*) Change Ext.ux.iconMgr.getIcon('/dev/common/icons.nsf/extjs/ux/icons/', 'application_view_list_1') for css class like this:
.myImg01{ background-image: url({your-url/application_view_list_1}) !important; };
Greetings,