/* * Ext JS Library 2.3.0 * Copyright(c) 2006-2009, Ext JS, LLC. * licensing@extjs.com * * http://extjs.com/license */ Ext.Toolbar=function(config){if(Ext.isArray(config)){config={buttons:config};} Ext.Toolbar.superclass.constructor.call(this,config);};(function(){var T=Ext.Toolbar;Ext.extend(T,Ext.BoxComponent,{trackMenus:true,initComponent:function(){T.superclass.initComponent.call(this);if(this.items){this.buttons=this.items;} this.items=new Ext.util.MixedCollection(false,function(o){return o.itemId||o.id||Ext.id();});},autoCreate:{cls:'x-toolbar x-small-editor',html:'
'},onRender:function(ct,position){this.el=ct.createChild(Ext.apply({id:this.id},this.autoCreate),position);this.tr=this.el.child("tr",true);},afterRender:function(){T.superclass.afterRender.call(this);if(this.buttons){this.add.apply(this,this.buttons);delete this.buttons;}},add:function(){var a=arguments,l=a.length;for(var i=0;i"){this.addFill();}else{this.addText(el);}}else if(el.tagName){this.addElement(el);}else if(typeof el=="object"){if(el.xtype){this.addField(Ext.ComponentMgr.create(el,'button'));}else{this.addButton(el);}}}},addSeparator:function(){return this.addItem(new T.Separator());},addSpacer:function(){return this.addItem(new T.Spacer());},addFill:function(){return this.addItem(new T.Fill());},addElement:function(el){return this.addItem(new T.Item(el));},addItem:function(item){var td=this.nextBlock();this.initMenuTracking(item);item.render(td);this.items.add(item);return item;},addButton:function(config){if(Ext.isArray(config)){var buttons=[];for(var i=0,len=config.length;i=1&pageNum<=d.pages){this.field.dom.value=pageNum;}}}},beforeLoad:function(){if(this.rendered&&this.loading){this.loading.disable();}},doLoad:function(start){var o={},pn=this.paramNames;o[pn.start]=start;o[pn.limit]=this.pageSize;if(this.fireEvent('beforechange',this,o)!==false){this.store.load({params:o});}},changePage:function(page){this.doLoad(((page-1)*this.pageSize).constrain(0,this.store.getTotalCount()));},onClick:function(which){var store=this.store;switch(which){case"first":this.doLoad(0);break;case"prev":this.doLoad(Math.max(0,this.cursor-this.pageSize));break;case"next":this.doLoad(this.cursor+this.pageSize);break;case"last":var total=store.getTotalCount();var extra=total%this.pageSize;var lastStart=extra?(total-extra):total-this.pageSize;this.doLoad(lastStart);break;case"refresh":this.doLoad(this.cursor);break;}},unbind:function(store){store=Ext.StoreMgr.lookup(store);store.un("beforeload",this.beforeLoad,this);store.un("load",this.onLoad,this);store.un("loadexception",this.onLoadError,this);this.store=undefined;},bind:function(store){store=Ext.StoreMgr.lookup(store);store.on("beforeload",this.beforeLoad,this);store.on("load",this.onLoad,this);store.on("loadexception",this.onLoadError,this);this.store=store;if(store.getCount()>0){this.onLoad(store,null,{});}},onDestroy:function(){if(this.store){this.unbind(this.store);} Ext.PagingToolbar.superclass.onDestroy.call(this);}});Ext.reg('paging',Ext.PagingToolbar);