/**
* @class Roo.PagingToolbar
* @extends Roo.Toolbar
+ * @children Roo.Toolbar.Item Roo.Toolbar.Button Roo.Toolbar.SplitButton Roo.form.Field
* A specialized toolbar that is bound to a {@link Roo.data.Store} and provides automatic paging controls.
* @constructor
* Create a new PagingToolbar
ds = el.dataSource;
el = config.container;
}
-
+ var items = [];
+ if (config.items) {
+ items = config.items;
+ config.items = [];
+ }
Roo.PagingToolbar.superclass.constructor.call(this, el, null, config);
this.ds = ds;
this.cursor = 0;
this.renderButtons(this.el);
this.bind(ds);
+
+ // supprot items array.
+
+ Roo.each(items, function(e) {
+ this.add(Roo.factory(e));
+ },this);
+
};
Roo.extend(Roo.PagingToolbar, Roo.Toolbar, {
- /**
- * @cfg {Roo.data.Store} dataSource
- * The underlying data store providing the paged data
- */
+
/**
* @cfg {String/HTMLElement/Element} container
* container The id or element that will contain the toolbar
* @cfg {Boolean} displayInfo
* True to display the displayMsg (defaults to false)
*/
+
+
/**
* @cfg {Number} pageSize
* The number of records to display per page (defaults to 20)
disabled: true,
handler: this.onClick.createDelegate(this, ["prev"])
});
- this.addSeparator();
+ //this.addSeparator();
this.add(this.beforePageText);
this.field = Roo.get(this.addDom({
tag: "input",
this.field.on("focus", function(){this.dom.select();});
this.afterTextEl = this.addText(String.format(this.afterPageText, 1));
this.field.setHeight(18);
- this.addSeparator();
+ //this.addSeparator();
this.next = this.addButton({
tooltip: this.nextText,
cls: "x-btn-icon x-grid-page-next",
disabled: true,
handler: this.onClick.createDelegate(this, ["last"])
});
- this.addSeparator();
+ //this.addSeparator();
this.loading = this.addButton({
tooltip: this.refreshText,
cls: "x-btn-icon x-grid-loading",
{
var v = this.field.dom.value, pageNum;
var increment = (e.shiftKey) ? 10 : 1;
- if(k == e.DOWN || k == e.LEFT || k == e.PAGEDOWN)
+ if(k == e.DOWN || k == e.LEFT || k == e.PAGEDOWN) {
increment *= -1;
+ }
if(!v || isNaN(pageNum = parseInt(v, 10))) {
this.field.dom.value = d.activePage;
return;
this.loading.disable();
}
},
-
+ /**
+ * event that occurs when you click on the navigation buttons - can be used to trigger load of a grid.
+ * @param {String} which (first|prev|next|last|refresh) which button to press.
+ *
+ */
// private
onClick : function(which){
var ds = this.ds;