You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1229 lines
39 KiB

2 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. /*
  2. This file is part of Ext JS 3.4
  3. Copyright (c) 2011-2013 Sencha Inc
  4. Contact: http://www.sencha.com/contact
  5. GNU General Public License Usage
  6. This file may be used under the terms of the GNU General Public License version 3.0 as
  7. published by the Free Software Foundation and appearing in the file LICENSE included in the
  8. packaging of this file.
  9. Please review the following information to ensure the GNU General Public License version 3.0
  10. requirements will be met: http://www.gnu.org/copyleft/gpl.html.
  11. If you are unsure which license is appropriate for your use, please contact the sales department
  12. at http://www.sencha.com/contact.
  13. Build date: 2013-04-03 15:07:25
  14. */
  15. /**
  16. * @class Ext.Toolbar
  17. * @extends Ext.Container
  18. * <p>Basic Toolbar class. Although the <tt>{@link Ext.Container#defaultType defaultType}</tt> for Toolbar
  19. * is <tt>{@link Ext.Button button}</tt>, Toolbar elements (child items for the Toolbar container) may
  20. * be virtually any type of Component. Toolbar elements can be created explicitly via their constructors,
  21. * or implicitly via their xtypes, and can be <tt>{@link #add}</tt>ed dynamically.</p>
  22. * <p>Some items have shortcut strings for creation:</p>
  23. * <pre>
  24. <u>Shortcut</u> <u>xtype</u> <u>Class</u> <u>Description</u>
  25. '->' 'tbfill' {@link Ext.Toolbar.Fill} begin using the right-justified button container
  26. '-' 'tbseparator' {@link Ext.Toolbar.Separator} add a vertical separator bar between toolbar items
  27. ' ' 'tbspacer' {@link Ext.Toolbar.Spacer} add horiztonal space between elements
  28. * </pre>
  29. *
  30. * Example usage of various elements:
  31. * <pre><code>
  32. var tb = new Ext.Toolbar({
  33. renderTo: document.body,
  34. width: 600,
  35. height: 100,
  36. items: [
  37. {
  38. // xtype: 'button', // default for Toolbars, same as 'tbbutton'
  39. text: 'Button'
  40. },
  41. {
  42. xtype: 'splitbutton', // same as 'tbsplitbutton'
  43. text: 'Split Button'
  44. },
  45. // begin using the right-justified button container
  46. '->', // same as {xtype: 'tbfill'}, // Ext.Toolbar.Fill
  47. {
  48. xtype: 'textfield',
  49. name: 'field1',
  50. emptyText: 'enter search term'
  51. },
  52. // add a vertical separator bar between toolbar items
  53. '-', // same as {xtype: 'tbseparator'} to create Ext.Toolbar.Separator
  54. 'text 1', // same as {xtype: 'tbtext', text: 'text1'} to create Ext.Toolbar.TextItem
  55. {xtype: 'tbspacer'},// same as ' ' to create Ext.Toolbar.Spacer
  56. 'text 2',
  57. {xtype: 'tbspacer', width: 50}, // add a 50px space
  58. 'text 3'
  59. ]
  60. });
  61. * </code></pre>
  62. * Example adding a ComboBox within a menu of a button:
  63. * <pre><code>
  64. // ComboBox creation
  65. var combo = new Ext.form.ComboBox({
  66. store: new Ext.data.ArrayStore({
  67. autoDestroy: true,
  68. fields: ['initials', 'fullname'],
  69. data : [
  70. ['FF', 'Fred Flintstone'],
  71. ['BR', 'Barney Rubble']
  72. ]
  73. }),
  74. displayField: 'fullname',
  75. typeAhead: true,
  76. mode: 'local',
  77. forceSelection: true,
  78. triggerAction: 'all',
  79. emptyText: 'Select a name...',
  80. selectOnFocus: true,
  81. width: 135,
  82. getListParent: function() {
  83. return this.el.up('.x-menu');
  84. },
  85. iconCls: 'no-icon' //use iconCls if placing within menu to shift to right side of menu
  86. });
  87. // put ComboBox in a Menu
  88. var menu = new Ext.menu.Menu({
  89. id: 'mainMenu',
  90. items: [
  91. combo // A Field in a Menu
  92. ]
  93. });
  94. // add a Button with the menu
  95. tb.add({
  96. text:'Button w/ Menu',
  97. menu: menu // assign menu by instance
  98. });
  99. tb.doLayout();
  100. * </code></pre>
  101. * @constructor
  102. * Creates a new Toolbar
  103. * @param {Object/Array} config A config object or an array of buttons to <tt>{@link #add}</tt>
  104. * @xtype toolbar
  105. */
  106. Ext.Toolbar = function(config){
  107. if(Ext.isArray(config)){
  108. config = {items: config, layout: 'toolbar'};
  109. } else {
  110. config = Ext.apply({
  111. layout: 'toolbar'
  112. }, config);
  113. if(config.buttons) {
  114. config.items = config.buttons;
  115. }
  116. }
  117. Ext.Toolbar.superclass.constructor.call(this, config);
  118. };
  119. (function(){
  120. var T = Ext.Toolbar;
  121. Ext.extend(T, Ext.Container, {
  122. defaultType: 'button',
  123. /**
  124. * @cfg {String/Object} layout
  125. * This class assigns a default layout (<code>layout:'<b>toolbar</b>'</code>).
  126. * Developers <i>may</i> override this configuration option if another layout
  127. * is required (the constructor must be passed a configuration object in this
  128. * case instead of an array).
  129. * See {@link Ext.Container#layout} for additional information.
  130. */
  131. enableOverflow : false,
  132. /**
  133. * @cfg {Boolean} enableOverflow
  134. * Defaults to false. Configure <tt>true</tt> to make the toolbar provide a button
  135. * which activates a dropdown Menu to show items which overflow the Toolbar's width.
  136. */
  137. /**
  138. * @cfg {String} buttonAlign
  139. * <p>The default position at which to align child items. Defaults to <code>"left"</code></p>
  140. * <p>May be specified as <code>"center"</code> to cause items added before a Fill (A <code>"->"</code>) item
  141. * to be centered in the Toolbar. Items added after a Fill are still right-aligned.</p>
  142. * <p>Specify as <code>"right"</code> to right align all child items.</p>
  143. */
  144. trackMenus : true,
  145. internalDefaults: {removeMode: 'container', hideParent: true},
  146. toolbarCls: 'x-toolbar',
  147. initComponent : function(){
  148. T.superclass.initComponent.call(this);
  149. /**
  150. * @event overflowchange
  151. * Fires after the overflow state has changed.
  152. * @param {Object} c The Container
  153. * @param {Boolean} lastOverflow overflow state
  154. */
  155. this.addEvents('overflowchange');
  156. },
  157. // private
  158. onRender : function(ct, position){
  159. if(!this.el){
  160. if(!this.autoCreate){
  161. this.autoCreate = {
  162. cls: this.toolbarCls + ' x-small-editor'
  163. };
  164. }
  165. this.el = ct.createChild(Ext.apply({ id: this.id },this.autoCreate), position);
  166. Ext.Toolbar.superclass.onRender.apply(this, arguments);
  167. }
  168. },
  169. /**
  170. * <p>Adds element(s) to the toolbar -- this function takes a variable number of
  171. * arguments of mixed type and adds them to the toolbar.</p>
  172. * <br><p><b>Note</b>: See the notes within {@link Ext.Container#add}.</p>
  173. * @param {Mixed} arg1 The following types of arguments are all valid:<br />
  174. * <ul>
  175. * <li>{@link Ext.Button} config: A valid button config object (equivalent to {@link #addButton})</li>
  176. * <li>HtmlElement: Any standard HTML element (equivalent to {@link #addElement})</li>
  177. * <li>Field: Any form field (equivalent to {@link #addField})</li>
  178. * <li>Item: Any subclass of {@link Ext.Toolbar.Item} (equivalent to {@link #addItem})</li>
  179. * <li>String: Any generic string (gets wrapped in a {@link Ext.Toolbar.TextItem}, equivalent to {@link #addText}).
  180. * Note that there are a few special strings that are treated differently as explained next.</li>
  181. * <li>'-': Creates a separator element (equivalent to {@link #addSeparator})</li>
  182. * <li>' ': Creates a spacer element (equivalent to {@link #addSpacer})</li>
  183. * <li>'->': Creates a fill element (equivalent to {@link #addFill})</li>
  184. * </ul>
  185. * @param {Mixed} arg2
  186. * @param {Mixed} etc.
  187. * @method add
  188. */
  189. // private
  190. lookupComponent : function(c){
  191. if(Ext.isString(c)){
  192. if(c == '-'){
  193. c = new T.Separator();
  194. }else if(c == ' '){
  195. c = new T.Spacer();
  196. }else if(c == '->'){
  197. c = new T.Fill();
  198. }else{
  199. c = new T.TextItem(c);
  200. }
  201. this.applyDefaults(c);
  202. }else{
  203. if(c.isFormField || c.render){ // some kind of form field, some kind of Toolbar.Item
  204. c = this.createComponent(c);
  205. }else if(c.tag){ // DomHelper spec
  206. c = new T.Item({autoEl: c});
  207. }else if(c.tagName){ // element
  208. c = new T.Item({el:c});
  209. }else if(Ext.isObject(c)){ // must be button config?
  210. c = c.xtype ? this.createComponent(c) : this.constructButton(c);
  211. }
  212. }
  213. return c;
  214. },
  215. // private
  216. applyDefaults : function(c){
  217. if(!Ext.isString(c)){
  218. c = Ext.Toolbar.superclass.applyDefaults.call(this, c);
  219. var d = this.internalDefaults;
  220. if(c.events){
  221. Ext.applyIf(c.initialConfig, d);
  222. Ext.apply(c, d);
  223. }else{
  224. Ext.applyIf(c, d);
  225. }
  226. }
  227. return c;
  228. },
  229. /**
  230. * Adds a separator
  231. * <br><p><b>Note</b>: See the notes within {@link Ext.Container#add}.</p>
  232. * @return {Ext.Toolbar.Item} The separator {@link Ext.Toolbar.Item item}
  233. */
  234. addSeparator : function(){
  235. return this.add(new T.Separator());
  236. },
  237. /**
  238. * Adds a spacer element
  239. * <br><p><b>Note</b>: See the notes within {@link Ext.Container#add}.</p>
  240. * @return {Ext.Toolbar.Spacer} The spacer item
  241. */
  242. addSpacer : function(){
  243. return this.add(new T.Spacer());
  244. },
  245. /**
  246. * Forces subsequent additions into the float:right toolbar
  247. * <br><p><b>Note</b>: See the notes within {@link Ext.Container#add}.</p>
  248. */
  249. addFill : function(){
  250. this.add(new T.Fill());
  251. },
  252. /**
  253. * Adds any standard HTML element to the toolbar
  254. * <br><p><b>Note</b>: See the notes within {@link Ext.Container#add}.</p>
  255. * @param {Mixed} el The element or id of the element to add
  256. * @return {Ext.Toolbar.Item} The element's item
  257. */
  258. addElement : function(el){
  259. return this.addItem(new T.Item({el:el}));
  260. },
  261. /**
  262. * Adds any Toolbar.Item or subclass
  263. * <br><p><b>Note</b>: See the notes within {@link Ext.Container#add}.</p>
  264. * @param {Ext.Toolbar.Item} item
  265. * @return {Ext.Toolbar.Item} The item
  266. */
  267. addItem : function(item){
  268. return this.add.apply(this, arguments);
  269. },
  270. /**
  271. * Adds a button (or buttons). See {@link Ext.Button} for more info on the config.
  272. * <br><p><b>Note</b>: See the notes within {@link Ext.Container#add}.</p>
  273. * @param {Object/Array} config A button config or array of configs
  274. * @return {Ext.Button/Array}
  275. */
  276. addButton : function(config){
  277. if(Ext.isArray(config)){
  278. var buttons = [];
  279. for(var i = 0, len = config.length; i < len; i++) {
  280. buttons.push(this.addButton(config[i]));
  281. }
  282. return buttons;
  283. }
  284. return this.add(this.constructButton(config));
  285. },
  286. /**
  287. * Adds text to the toolbar
  288. * <br><p><b>Note</b>: See the notes within {@link Ext.Container#add}.</p>
  289. * @param {String} text The text to add
  290. * @return {Ext.Toolbar.Item} The element's item
  291. */
  292. addText : function(text){
  293. return this.addItem(new T.TextItem(text));
  294. },
  295. /**
  296. * Adds a new element to the toolbar from the passed {@link Ext.DomHelper} config
  297. * <br><p><b>Note</b>: See the notes within {@link Ext.Container#add}.</p>
  298. * @param {Object} config
  299. * @return {Ext.Toolbar.Item} The element's item
  300. */
  301. addDom : function(config){
  302. return this.add(new T.Item({autoEl: config}));
  303. },
  304. /**
  305. * Adds a dynamically rendered Ext.form field (TextField, ComboBox, etc). Note: the field should not have
  306. * been rendered yet. For a field that has already been rendered, use {@link #addElement}.
  307. * <br><p><b>Note</b>: See the notes within {@link Ext.Container#add}.</p>
  308. * @param {Ext.form.Field} field
  309. * @return {Ext.Toolbar.Item}
  310. */
  311. addField : function(field){
  312. return this.add(field);
  313. },
  314. /**
  315. * Inserts any {@link Ext.Toolbar.Item}/{@link Ext.Button} at the specified index.
  316. * <br><p><b>Note</b>: See the notes within {@link Ext.Container#add}.</p>
  317. * @param {Number} index The index where the item is to be inserted
  318. * @param {Object/Ext.Toolbar.Item/Ext.Button/Array} item The button, or button config object to be
  319. * inserted, or an array of buttons/configs.
  320. * @return {Ext.Button/Item}
  321. */
  322. insertButton : function(index, item){
  323. if(Ext.isArray(item)){
  324. var buttons = [];
  325. for(var i = 0, len = item.length; i < len; i++) {
  326. buttons.push(this.insertButton(index + i, item[i]));
  327. }
  328. return buttons;
  329. }
  330. return Ext.Toolbar.superclass.insert.call(this, index, item);
  331. },
  332. // private
  333. trackMenu : function(item, remove){
  334. if(this.trackMenus && item.menu){
  335. var method = remove ? 'mun' : 'mon';
  336. this[method](item, 'menutriggerover', this.onButtonTriggerOver, this);
  337. this[method](item, 'menushow', this.onButtonMenuShow, this);
  338. this[method](item, 'menuhide', this.onButtonMenuHide, this);
  339. }
  340. },
  341. // private
  342. constructButton : function(item){
  343. var b = item.events ? item : this.createComponent(item, item.split ? 'splitbutton' : this.defaultType);
  344. return b;
  345. },
  346. // private
  347. onAdd : function(c){
  348. Ext.Toolbar.superclass.onAdd.call(this);
  349. this.trackMenu(c);
  350. if(this.disabled){
  351. c.disable();
  352. }
  353. },
  354. // private
  355. onRemove : function(c){
  356. Ext.Toolbar.superclass.onRemove.call(this);
  357. if (c == this.activeMenuBtn) {
  358. delete this.activeMenuBtn;
  359. }
  360. this.trackMenu(c, true);
  361. },
  362. // private
  363. onDisable : function(){
  364. this.items.each(function(item){
  365. if(item.disable){
  366. item.disable();
  367. }
  368. });
  369. },
  370. // private
  371. onEnable : function(){
  372. this.items.each(function(item){
  373. if(item.enable){
  374. item.enable();
  375. }
  376. });
  377. },
  378. // private
  379. onButtonTriggerOver : function(btn){
  380. if(this.activeMenuBtn && this.activeMenuBtn != btn){
  381. this.activeMenuBtn.hideMenu();
  382. btn.showMenu();
  383. this.activeMenuBtn = btn;
  384. }
  385. },
  386. // private
  387. onButtonMenuShow : function(btn){
  388. this.activeMenuBtn = btn;
  389. },
  390. // private
  391. onButtonMenuHide : function(btn){
  392. delete this.activeMenuBtn;
  393. }
  394. });
  395. Ext.reg('toolbar', Ext.Toolbar);
  396. /**
  397. * @class Ext.Toolbar.Item
  398. * @extends Ext.BoxComponent
  399. * The base class that other non-interacting Toolbar Item classes should extend in order to
  400. * get some basic common toolbar item functionality.
  401. * @constructor
  402. * Creates a new Item
  403. * @param {HTMLElement} el
  404. * @xtype tbitem
  405. */
  406. T.Item = Ext.extend(Ext.BoxComponent, {
  407. hideParent: true, // Hiding a Toolbar.Item hides its containing TD
  408. enable:Ext.emptyFn,
  409. disable:Ext.emptyFn,
  410. focus:Ext.emptyFn
  411. /**
  412. * @cfg {String} overflowText Text to be used for the menu if the item is overflowed.
  413. */
  414. });
  415. Ext.reg('tbitem', T.Item);
  416. /**
  417. * @class Ext.Toolbar.Separator
  418. * @extends Ext.Toolbar.Item
  419. * A simple class that adds a vertical separator bar between toolbar items
  420. * (css class:<tt>'xtb-sep'</tt>). Example usage:
  421. * <pre><code>
  422. new Ext.Panel({
  423. tbar : [
  424. 'Item 1',
  425. {xtype: 'tbseparator'}, // or '-'
  426. 'Item 2'
  427. ]
  428. });
  429. </code></pre>
  430. * @constructor
  431. * Creates a new Separator
  432. * @xtype tbseparator
  433. */
  434. T.Separator = Ext.extend(T.Item, {
  435. onRender : function(ct, position){
  436. this.el = ct.createChild({tag:'span', cls:'xtb-sep'}, position);
  437. }
  438. });
  439. Ext.reg('tbseparator', T.Separator);
  440. /**
  441. * @class Ext.Toolbar.Spacer
  442. * @extends Ext.Toolbar.Item
  443. * A simple element that adds extra horizontal space between items in a toolbar.
  444. * By default a 2px wide space is added via css specification:<pre><code>
  445. .x-toolbar .xtb-spacer {
  446. width:2px;
  447. }
  448. * </code></pre>
  449. * <p>Example usage:</p>
  450. * <pre><code>
  451. new Ext.Panel({
  452. tbar : [
  453. 'Item 1',
  454. {xtype: 'tbspacer'}, // or ' '
  455. 'Item 2',
  456. // space width is also configurable via javascript
  457. {xtype: 'tbspacer', width: 50}, // add a 50px space
  458. 'Item 3'
  459. ]
  460. });
  461. </code></pre>
  462. * @constructor
  463. * Creates a new Spacer
  464. * @xtype tbspacer
  465. */
  466. T.Spacer = Ext.extend(T.Item, {
  467. /**
  468. * @cfg {Number} width
  469. * The width of the spacer in pixels (defaults to 2px via css style <tt>.x-toolbar .xtb-spacer</tt>).
  470. */
  471. onRender : function(ct, position){
  472. this.el = ct.createChild({tag:'div', cls:'xtb-spacer', style: this.width?'width:'+this.width+'px':''}, position);
  473. }
  474. });
  475. Ext.reg('tbspacer', T.Spacer);
  476. /**
  477. * @class Ext.Toolbar.Fill
  478. * @extends Ext.Toolbar.Spacer
  479. * A non-rendering placeholder item which instructs the Toolbar's Layout to begin using
  480. * the right-justified button container.
  481. * <pre><code>
  482. new Ext.Panel({
  483. tbar : [
  484. 'Item 1',
  485. {xtype: 'tbfill'}, // or '->'
  486. 'Item 2'
  487. ]
  488. });
  489. </code></pre>
  490. * @constructor
  491. * Creates a new Fill
  492. * @xtype tbfill
  493. */
  494. T.Fill = Ext.extend(T.Item, {
  495. // private
  496. render : Ext.emptyFn,
  497. isFill : true
  498. });
  499. Ext.reg('tbfill', T.Fill);
  500. /**
  501. * @class Ext.Toolbar.TextItem
  502. * @extends Ext.Toolbar.Item
  503. * A simple class that renders text directly into a toolbar
  504. * (with css class:<tt>'xtb-text'</tt>). Example usage:
  505. * <pre><code>
  506. new Ext.Panel({
  507. tbar : [
  508. {xtype: 'tbtext', text: 'Item 1'} // or simply 'Item 1'
  509. ]
  510. });
  511. </code></pre>
  512. * @constructor
  513. * Creates a new TextItem
  514. * @param {String/Object} text A text string, or a config object containing a <tt>text</tt> property
  515. * @xtype tbtext
  516. */
  517. T.TextItem = Ext.extend(T.Item, {
  518. /**
  519. * @cfg {String} text The text to be used as innerHTML (html tags are accepted)
  520. */
  521. constructor: function(config){
  522. T.TextItem.superclass.constructor.call(this, Ext.isString(config) ? {text: config} : config);
  523. },
  524. // private
  525. onRender : function(ct, position) {
  526. this.autoEl = {cls: 'xtb-text', html: this.text || ''};
  527. T.TextItem.superclass.onRender.call(this, ct, position);
  528. },
  529. /**
  530. * Updates this item's text, setting the text to be used as innerHTML.
  531. * @param {String} t The text to display (html accepted).
  532. */
  533. setText : function(t) {
  534. if(this.rendered){
  535. this.el.update(t);
  536. }else{
  537. this.text = t;
  538. }
  539. }
  540. });
  541. Ext.reg('tbtext', T.TextItem);
  542. // backwards compat
  543. T.Button = Ext.extend(Ext.Button, {});
  544. T.SplitButton = Ext.extend(Ext.SplitButton, {});
  545. Ext.reg('tbbutton', T.Button);
  546. Ext.reg('tbsplit', T.SplitButton);
  547. })();
  548. /**
  549. * @class Ext.ButtonGroup
  550. * @extends Ext.Panel
  551. * Container for a group of buttons. Example usage:
  552. * <pre><code>
  553. var p = new Ext.Panel({
  554. title: 'Panel with Button Group',
  555. width: 300,
  556. height:200,
  557. renderTo: document.body,
  558. html: 'whatever',
  559. tbar: [{
  560. xtype: 'buttongroup',
  561. {@link #columns}: 3,
  562. title: 'Clipboard',
  563. items: [{
  564. text: 'Paste',
  565. scale: 'large',
  566. rowspan: 3, iconCls: 'add',
  567. iconAlign: 'top',
  568. cls: 'x-btn-as-arrow'
  569. },{
  570. xtype:'splitbutton',
  571. text: 'Menu Button',
  572. scale: 'large',
  573. rowspan: 3,
  574. iconCls: 'add',
  575. iconAlign: 'top',
  576. arrowAlign:'bottom',
  577. menu: [{text: 'Menu Item 1'}]
  578. },{
  579. xtype:'splitbutton', text: 'Cut', iconCls: 'add16', menu: [{text: 'Cut Menu Item'}]
  580. },{
  581. text: 'Copy', iconCls: 'add16'
  582. },{
  583. text: 'Format', iconCls: 'add16'
  584. }]
  585. }]
  586. });
  587. * </code></pre>
  588. * @constructor
  589. * Create a new ButtonGroup.
  590. * @param {Object} config The config object
  591. * @xtype buttongroup
  592. */
  593. Ext.ButtonGroup = Ext.extend(Ext.Panel, {
  594. /**
  595. * @cfg {Number} columns The <tt>columns</tt> configuration property passed to the
  596. * {@link #layout configured layout manager}. See {@link Ext.layout.TableLayout#columns}.
  597. */
  598. /**
  599. * @cfg {String} baseCls Defaults to <tt>'x-btn-group'</tt>. See {@link Ext.Panel#baseCls}.
  600. */
  601. baseCls: 'x-btn-group',
  602. /**
  603. * @cfg {String} layout Defaults to <tt>'table'</tt>. See {@link Ext.Container#layout}.
  604. */
  605. layout:'table',
  606. defaultType: 'button',
  607. /**
  608. * @cfg {Boolean} frame Defaults to <tt>true</tt>. See {@link Ext.Panel#frame}.
  609. */
  610. frame: true,
  611. internalDefaults: {removeMode: 'container', hideParent: true},
  612. initComponent : function(){
  613. this.layoutConfig = this.layoutConfig || {};
  614. Ext.applyIf(this.layoutConfig, {
  615. columns : this.columns
  616. });
  617. if(!this.title){
  618. this.addClass('x-btn-group-notitle');
  619. }
  620. this.on('afterlayout', this.onAfterLayout, this);
  621. Ext.ButtonGroup.superclass.initComponent.call(this);
  622. },
  623. applyDefaults : function(c){
  624. c = Ext.ButtonGroup.superclass.applyDefaults.call(this, c);
  625. var d = this.internalDefaults;
  626. if(c.events){
  627. Ext.applyIf(c.initialConfig, d);
  628. Ext.apply(c, d);
  629. }else{
  630. Ext.applyIf(c, d);
  631. }
  632. return c;
  633. },
  634. onAfterLayout : function(){
  635. var bodyWidth = this.body.getFrameWidth('lr') + this.body.dom.firstChild.offsetWidth;
  636. this.body.setWidth(bodyWidth);
  637. this.el.setWidth(bodyWidth + this.getFrameWidth());
  638. }
  639. /**
  640. * @cfg {Array} tools @hide
  641. */
  642. });
  643. Ext.reg('buttongroup', Ext.ButtonGroup);
  644. /**
  645. * @class Ext.PagingToolbar
  646. * @extends Ext.Toolbar
  647. * <p>As the amount of records increases, the time required for the browser to render
  648. * them increases. Paging is used to reduce the amount of data exchanged with the client.
  649. * Note: if there are more records/rows than can be viewed in the available screen area, vertical
  650. * scrollbars will be added.</p>
  651. * <p>Paging is typically handled on the server side (see exception below). The client sends
  652. * parameters to the server side, which the server needs to interpret and then respond with the
  653. * approprate data.</p>
  654. * <p><b>Ext.PagingToolbar</b> is a specialized toolbar that is bound to a {@link Ext.data.Store}
  655. * and provides automatic paging control. This Component {@link Ext.data.Store#load load}s blocks
  656. * of data into the <tt>{@link #store}</tt> by passing {@link Ext.data.Store#paramNames paramNames} used for
  657. * paging criteria.</p>
  658. * <p>PagingToolbar is typically used as one of the Grid's toolbars:</p>
  659. * <pre><code>
  660. Ext.QuickTips.init(); // to display button quicktips
  661. var myStore = new Ext.data.Store({
  662. reader: new Ext.data.JsonReader({
  663. {@link Ext.data.JsonReader#totalProperty totalProperty}: 'results',
  664. ...
  665. }),
  666. ...
  667. });
  668. var myPageSize = 25; // server script should only send back 25 items at a time
  669. var grid = new Ext.grid.GridPanel({
  670. ...
  671. store: myStore,
  672. bbar: new Ext.PagingToolbar({
  673. {@link #store}: myStore, // grid and PagingToolbar using same store
  674. {@link #displayInfo}: true,
  675. {@link #pageSize}: myPageSize,
  676. {@link #prependButtons}: true,
  677. items: [
  678. 'text 1'
  679. ]
  680. })
  681. });
  682. * </code></pre>
  683. *
  684. * <p>To use paging, pass the paging requirements to the server when the store is first loaded.</p>
  685. * <pre><code>
  686. store.load({
  687. params: {
  688. // specify params for the first page load if using paging
  689. start: 0,
  690. limit: myPageSize,
  691. // other params
  692. foo: 'bar'
  693. }
  694. });
  695. * </code></pre>
  696. *
  697. * <p>If using {@link Ext.data.Store#autoLoad store's autoLoad} configuration:</p>
  698. * <pre><code>
  699. var myStore = new Ext.data.Store({
  700. {@link Ext.data.Store#autoLoad autoLoad}: {params:{start: 0, limit: 25}},
  701. ...
  702. });
  703. * </code></pre>
  704. *
  705. * <p>The packet sent back from the server would have this form:</p>
  706. * <pre><code>
  707. {
  708. "success": true,
  709. "results": 2000,
  710. "rows": [ // <b>*Note:</b> this must be an Array
  711. { "id": 1, "name": "Bill", "occupation": "Gardener" },
  712. { "id": 2, "name": "Ben", "occupation": "Horticulturalist" },
  713. ...
  714. { "id": 25, "name": "Sue", "occupation": "Botanist" }
  715. ]
  716. }
  717. * </code></pre>
  718. * <p><u>Paging with Local Data</u></p>
  719. * <p>Paging can also be accomplished with local data using extensions:</p>
  720. * <div class="mdetail-params"><ul>
  721. * <li><a href="http://extjs.com/forum/showthread.php?t=71532">Ext.ux.data.PagingStore</a></li>
  722. * <li>Paging Memory Proxy (examples/ux/PagingMemoryProxy.js)</li>
  723. * </ul></div>
  724. * @constructor Create a new PagingToolbar
  725. * @param {Object} config The config object
  726. * @xtype paging
  727. */
  728. (function() {
  729. var T = Ext.Toolbar;
  730. Ext.PagingToolbar = Ext.extend(Ext.Toolbar, {
  731. /**
  732. * @cfg {Ext.data.Store} store
  733. * The {@link Ext.data.Store} the paging toolbar should use as its data source (required).
  734. */
  735. /**
  736. * @cfg {Boolean} displayInfo
  737. * <tt>true</tt> to display the displayMsg (defaults to <tt>false</tt>)
  738. */
  739. /**
  740. * @cfg {Number} pageSize
  741. * The number of records to display per page (defaults to <tt>20</tt>)
  742. */
  743. pageSize : 20,
  744. /**
  745. * @cfg {Boolean} prependButtons
  746. * <tt>true</tt> to insert any configured <tt>items</tt> <i>before</i> the paging buttons.
  747. * Defaults to <tt>false</tt>.
  748. */
  749. /**
  750. * @cfg {String} displayMsg
  751. * The paging status message to display (defaults to <tt>'Displaying {0} - {1} of {2}'</tt>).
  752. * Note that this string is formatted using the braced numbers <tt>{0}-{2}</tt> as tokens
  753. * that are replaced by the values for start, end and total respectively. These tokens should
  754. * be preserved when overriding this string if showing those values is desired.
  755. */
  756. displayMsg : 'Displaying {0} - {1} of {2}',
  757. /**
  758. * @cfg {String} emptyMsg
  759. * The message to display when no records are found (defaults to 'No data to display')
  760. */
  761. emptyMsg : 'No data to display',
  762. /**
  763. * @cfg {String} beforePageText
  764. * The text displayed before the input item (defaults to <tt>'Page'</tt>).
  765. */
  766. beforePageText : 'Page',
  767. /**
  768. * @cfg {String} afterPageText
  769. * Customizable piece of the default paging text (defaults to <tt>'of {0}'</tt>). Note that
  770. * this string is formatted using <tt>{0}</tt> as a token that is replaced by the number of
  771. * total pages. This token should be preserved when overriding this string if showing the
  772. * total page count is desired.
  773. */
  774. afterPageText : 'of {0}',
  775. /**
  776. * @cfg {String} firstText
  777. * The quicktip text displayed for the first page button (defaults to <tt>'First Page'</tt>).
  778. * <b>Note</b>: quick tips must be initialized for the quicktip to show.
  779. */
  780. firstText : 'First Page',
  781. /**
  782. * @cfg {String} prevText
  783. * The quicktip text displayed for the previous page button (defaults to <tt>'Previous Page'</tt>).
  784. * <b>Note</b>: quick tips must be initialized for the quicktip to show.
  785. */
  786. prevText : 'Previous Page',
  787. /**
  788. * @cfg {String} nextText
  789. * The quicktip text displayed for the next page button (defaults to <tt>'Next Page'</tt>).
  790. * <b>Note</b>: quick tips must be initialized for the quicktip to show.
  791. */
  792. nextText : 'Next Page',
  793. /**
  794. * @cfg {String} lastText
  795. * The quicktip text displayed for the last page button (defaults to <tt>'Last Page'</tt>).
  796. * <b>Note</b>: quick tips must be initialized for the quicktip to show.
  797. */
  798. lastText : 'Last Page',
  799. /**
  800. * @cfg {String} refreshText
  801. * The quicktip text displayed for the Refresh button (defaults to <tt>'Refresh'</tt>).
  802. * <b>Note</b>: quick tips must be initialized for the quicktip to show.
  803. */
  804. refreshText : 'Refresh',
  805. /**
  806. * <p><b>Deprecated</b>. <code>paramNames</code> should be set in the <b>data store</b>
  807. * (see {@link Ext.data.Store#paramNames}).</p>
  808. * <br><p>Object mapping of parameter names used for load calls, initially set to:</p>
  809. * <pre>{start: 'start', limit: 'limit'}</pre>
  810. * @type Object
  811. * @property paramNames
  812. * @deprecated
  813. */
  814. /**
  815. * The number of records to display per page. See also <tt>{@link #cursor}</tt>.
  816. * @type Number
  817. * @property pageSize
  818. */
  819. /**
  820. * Indicator for the record position. This property might be used to get the active page
  821. * number for example:<pre><code>
  822. * // t is reference to the paging toolbar instance
  823. * var activePage = Math.ceil((t.cursor + t.pageSize) / t.pageSize);
  824. * </code></pre>
  825. * @type Number
  826. * @property cursor
  827. */
  828. initComponent : function(){
  829. var pagingItems = [this.first = new T.Button({
  830. tooltip: this.firstText,
  831. overflowText: this.firstText,
  832. iconCls: 'x-tbar-page-first',
  833. disabled: true,
  834. handler: this.moveFirst,
  835. scope: this
  836. }), this.prev = new T.Button({
  837. tooltip: this.prevText,
  838. overflowText: this.prevText,
  839. iconCls: 'x-tbar-page-prev',
  840. disabled: true,
  841. handler: this.movePrevious,
  842. scope: this
  843. }), '-', this.beforePageText,
  844. this.inputItem = new Ext.form.NumberField({
  845. cls: 'x-tbar-page-number',
  846. allowDecimals: false,
  847. allowNegative: false,
  848. enableKeyEvents: true,
  849. selectOnFocus: true,
  850. submitValue: false,
  851. listeners: {
  852. scope: this,
  853. keydown: this.onPagingKeyDown,
  854. blur: this.onPagingBlur
  855. }
  856. }), this.afterTextItem = new T.TextItem({
  857. text: String.format(this.afterPageText, 1)
  858. }), '-', this.next = new T.Button({
  859. tooltip: this.nextText,
  860. overflowText: this.nextText,
  861. iconCls: 'x-tbar-page-next',
  862. disabled: true,
  863. handler: this.moveNext,
  864. scope: this
  865. }), this.last = new T.Button({
  866. tooltip: this.lastText,
  867. overflowText: this.lastText,
  868. iconCls: 'x-tbar-page-last',
  869. disabled: true,
  870. handler: this.moveLast,
  871. scope: this
  872. }), '-', this.refresh = new T.Button({
  873. tooltip: this.refreshText,
  874. overflowText: this.refreshText,
  875. iconCls: 'x-tbar-loading',
  876. handler: this.doRefresh,
  877. scope: this
  878. })];
  879. var userItems = this.items || this.buttons || [];
  880. if (this.prependButtons) {
  881. this.items = userItems.concat(pagingItems);
  882. }else{
  883. this.items = pagingItems.concat(userItems);
  884. }
  885. delete this.buttons;
  886. if(this.displayInfo){
  887. this.items.push('->');
  888. this.items.push(this.displayItem = new T.TextItem({}));
  889. }
  890. Ext.PagingToolbar.superclass.initComponent.call(this);
  891. this.addEvents(
  892. /**
  893. * @event change
  894. * Fires after the active page has been changed.
  895. * @param {Ext.PagingToolbar} this
  896. * @param {Object} pageData An object that has these properties:<ul>
  897. * <li><code>total</code> : Number <div class="sub-desc">The total number of records in the dataset as
  898. * returned by the server</div></li>
  899. * <li><code>activePage</code> : Number <div class="sub-desc">The current page number</div></li>
  900. * <li><code>pages</code> : Number <div class="sub-desc">The total number of pages (calculated from
  901. * the total number of records in the dataset as returned by the server and the current {@link #pageSize})</div></li>
  902. * </ul>
  903. */
  904. 'change',
  905. /**
  906. * @event beforechange
  907. * Fires just before the active page is changed.
  908. * Return false to prevent the active page from being changed.
  909. * @param {Ext.PagingToolbar} this
  910. * @param {Object} params An object hash of the parameters which the PagingToolbar will send when
  911. * loading the required page. This will contain:<ul>
  912. * <li><code>start</code> : Number <div class="sub-desc">The starting row number for the next page of records to
  913. * be retrieved from the server</div></li>
  914. * <li><code>limit</code> : Number <div class="sub-desc">The number of records to be retrieved from the server</div></li>
  915. * </ul>
  916. * <p>(note: the names of the <b>start</b> and <b>limit</b> properties are determined
  917. * by the store's {@link Ext.data.Store#paramNames paramNames} property.)</p>
  918. * <p>Parameters may be added as required in the event handler.</p>
  919. */
  920. 'beforechange'
  921. );
  922. this.on('afterlayout', this.onFirstLayout, this, {single: true});
  923. this.cursor = 0;
  924. this.bindStore(this.store, true);
  925. },
  926. // private
  927. onFirstLayout : function(){
  928. if(this.dsLoaded){
  929. this.onLoad.apply(this, this.dsLoaded);
  930. }
  931. },
  932. // private
  933. updateInfo : function(){
  934. if(this.displayItem){
  935. var count = this.store.getCount();
  936. var msg = count == 0 ?
  937. this.emptyMsg :
  938. String.format(
  939. this.displayMsg,
  940. this.cursor+1, this.cursor+count, this.store.getTotalCount()
  941. );
  942. this.displayItem.setText(msg);
  943. }
  944. },
  945. // private
  946. onLoad : function(store, r, o){
  947. if(!this.rendered){
  948. this.dsLoaded = [store, r, o];
  949. return;
  950. }
  951. var p = this.getParams();
  952. this.cursor = (o.params && o.params[p.start]) ? o.params[p.start] : 0;
  953. var d = this.getPageData(), ap = d.activePage, ps = d.pages;
  954. this.afterTextItem.setText(String.format(this.afterPageText, d.pages));
  955. this.inputItem.setValue(ap);
  956. this.first.setDisabled(ap == 1);
  957. this.prev.setDisabled(ap == 1);
  958. this.next.setDisabled(ap == ps);
  959. this.last.setDisabled(ap == ps);
  960. this.refresh.enable();
  961. this.updateInfo();
  962. this.fireEvent('change', this, d);
  963. },
  964. // private
  965. getPageData : function(){
  966. var total = this.store.getTotalCount();
  967. return {
  968. total : total,
  969. activePage : Math.ceil((this.cursor+this.pageSize)/this.pageSize),
  970. pages : total < this.pageSize ? 1 : Math.ceil(total/this.pageSize)
  971. };
  972. },
  973. /**
  974. * Change the active page
  975. * @param {Integer} page The page to display
  976. */
  977. changePage : function(page){
  978. this.doLoad(((page-1) * this.pageSize).constrain(0, this.store.getTotalCount()));
  979. },
  980. // private
  981. onLoadError : function(){
  982. if(!this.rendered){
  983. return;
  984. }
  985. this.refresh.enable();
  986. },
  987. // private
  988. readPage : function(d){
  989. var v = this.inputItem.getValue(), pageNum;
  990. if (!v || isNaN(pageNum = parseInt(v, 10))) {
  991. this.inputItem.setValue(d.activePage);
  992. return false;
  993. }
  994. return pageNum;
  995. },
  996. onPagingFocus : function(){
  997. this.inputItem.select();
  998. },
  999. //private
  1000. onPagingBlur : function(e){
  1001. this.inputItem.setValue(this.getPageData().activePage);
  1002. },
  1003. // private
  1004. onPagingKeyDown : function(field, e){
  1005. var k = e.getKey(), d = this.getPageData(), pageNum;
  1006. if (k == e.RETURN) {
  1007. e.stopEvent();
  1008. pageNum = this.readPage(d);
  1009. if(pageNum !== false){
  1010. pageNum = Math.min(Math.max(1, pageNum), d.pages) - 1;
  1011. this.doLoad(pageNum * this.pageSize);
  1012. }
  1013. }else if (k == e.HOME || k == e.END){
  1014. e.stopEvent();
  1015. pageNum = k == e.HOME ? 1 : d.pages;
  1016. field.setValue(pageNum);
  1017. }else if (k == e.UP || k == e.PAGEUP || k == e.DOWN || k == e.PAGEDOWN){
  1018. e.stopEvent();
  1019. if((pageNum = this.readPage(d))){
  1020. var increment = e.shiftKey ? 10 : 1;
  1021. if(k == e.DOWN || k == e.PAGEDOWN){
  1022. increment *= -1;
  1023. }
  1024. pageNum += increment;
  1025. if(pageNum >= 1 & pageNum <= d.pages){
  1026. field.setValue(pageNum);
  1027. }
  1028. }
  1029. }
  1030. },
  1031. // private
  1032. getParams : function(){
  1033. //retain backwards compat, allow params on the toolbar itself, if they exist.
  1034. return this.paramNames || this.store.paramNames;
  1035. },
  1036. // private
  1037. beforeLoad : function(){
  1038. if(this.rendered && this.refresh){
  1039. this.refresh.disable();
  1040. }
  1041. },
  1042. // private
  1043. doLoad : function(start){
  1044. var o = {}, pn = this.getParams();
  1045. o[pn.start] = start;
  1046. o[pn.limit] = this.pageSize;
  1047. if(this.fireEvent('beforechange', this, o) !== false){
  1048. this.store.load({params:o});
  1049. }
  1050. },
  1051. /**
  1052. * Move to the first page, has the same effect as clicking the 'first' button.
  1053. */
  1054. moveFirst : function(){
  1055. this.doLoad(0);
  1056. },
  1057. /**
  1058. * Move to the previous page, has the same effect as clicking the 'previous' button.
  1059. */
  1060. movePrevious : function(){
  1061. this.doLoad(Math.max(0, this.cursor-this.pageSize));
  1062. },
  1063. /**
  1064. * Move to the next page, has the same effect as clicking the 'next' button.
  1065. */
  1066. moveNext : function(){
  1067. this.doLoad(this.cursor+this.pageSize);
  1068. },
  1069. /**
  1070. * Move to the last page, has the same effect as clicking the 'last' button.
  1071. */
  1072. moveLast : function(){
  1073. var total = this.store.getTotalCount(),
  1074. extra = total % this.pageSize;
  1075. this.doLoad(extra ? (total - extra) : total - this.pageSize);
  1076. },
  1077. /**
  1078. * Refresh the current page, has the same effect as clicking the 'refresh' button.
  1079. */
  1080. doRefresh : function(){
  1081. this.doLoad(this.cursor);
  1082. },
  1083. /**
  1084. * Binds the paging toolbar to the specified {@link Ext.data.Store}
  1085. * @param {Store} store The store to bind to this toolbar
  1086. * @param {Boolean} initial (Optional) true to not remove listeners
  1087. */
  1088. bindStore : function(store, initial){
  1089. var doLoad;
  1090. if(!initial && this.store){
  1091. if(store !== this.store && this.store.autoDestroy){
  1092. this.store.destroy();
  1093. }else{
  1094. this.store.un('beforeload', this.beforeLoad, this);
  1095. this.store.un('load', this.onLoad, this);
  1096. this.store.un('exception', this.onLoadError, this);
  1097. }
  1098. if(!store){
  1099. this.store = null;
  1100. }
  1101. }
  1102. if(store){
  1103. store = Ext.StoreMgr.lookup(store);
  1104. store.on({
  1105. scope: this,
  1106. beforeload: this.beforeLoad,
  1107. load: this.onLoad,
  1108. exception: this.onLoadError
  1109. });
  1110. doLoad = true;
  1111. }
  1112. this.store = store;
  1113. if(doLoad){
  1114. this.onLoad(store, null, {});
  1115. }
  1116. },
  1117. /**
  1118. * Unbinds the paging toolbar from the specified {@link Ext.data.Store} <b>(deprecated)</b>
  1119. * @param {Ext.data.Store} store The data store to unbind
  1120. */
  1121. unbind : function(store){
  1122. this.bindStore(null);
  1123. },
  1124. /**
  1125. * Binds the paging toolbar to the specified {@link Ext.data.Store} <b>(deprecated)</b>
  1126. * @param {Ext.data.Store} store The data store to bind
  1127. */
  1128. bind : function(store){
  1129. this.bindStore(store);
  1130. },
  1131. // private
  1132. onDestroy : function(){
  1133. this.bindStore(null);
  1134. Ext.PagingToolbar.superclass.onDestroy.call(this);
  1135. }
  1136. });
  1137. })();
  1138. Ext.reg('paging', Ext.PagingToolbar);