X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/7a654f8d43fdb43d78b63d90528bed6e86b608cc..6746dc89c47ed01b165cc1152533605f97eb8e8d:/docs/source/Paging.html diff --git a/docs/source/Paging.html b/docs/source/Paging.html index 3c2c6915..3785053a 100644 --- a/docs/source/Paging.html +++ b/docs/source/Paging.html @@ -1,5 +1,22 @@ -
+ +/** - * @class Ext.toolbar.Paging + + + + +\ No newline at end of file +The source code + + + + + + +/** + * @class Ext.toolbar.Paging * @extends Ext.toolbar.Toolbar * <p>As the amount of records increases, the time required for the browser to render * them increases. Paging is used to reduce the amount of data exchanged with the client. @@ -103,31 +120,28 @@ var myStore = new Ext.data.Store({ * <li><a href="http://sencha.com/forum/showthread.php?t=71532">Ext.ux.data.PagingStore</a></li> * <li>Paging Memory Proxy (examples/ux/PagingMemoryProxy.js)</li> * </ul></div> - * @constructor Create a new PagingToolbar - * @param {Object} config The config object - * @xtype pagingtoolbar */ Ext.define('Ext.toolbar.Paging', { extend: 'Ext.toolbar.Toolbar', alias: 'widget.pagingtoolbar', alternateClassName: 'Ext.PagingToolbar', requires: ['Ext.toolbar.TextItem', 'Ext.form.field.Number'], - /** + /** * @cfg {Ext.data.Store} store * The {@link Ext.data.Store} the paging toolbar should use as its data source (required). */ - /** + /** * @cfg {Boolean} displayInfo * <tt>true</tt> to display the displayMsg (defaults to <tt>false</tt>) */ displayInfo: false, - /** + /** * @cfg {Boolean} prependButtons * <tt>true</tt> to insert any configured <tt>items</tt> <i>before</i> the paging buttons. * Defaults to <tt>false</tt>. */ prependButtons: false, - /** + /** * @cfg {String} displayMsg * The paging status message to display (defaults to <tt>'Displaying {0} - {1} of {2}'</tt>). * Note that this string is formatted using the braced numbers <tt>{0}-{2}</tt> as tokens @@ -135,17 +149,17 @@ Ext.define('Ext.toolbar.Paging', { * be preserved when overriding this string if showing those values is desired. */ displayMsg : 'Displaying {0} - {1} of {2}', - /** + /** * @cfg {String} emptyMsg * The message to display when no records are found (defaults to 'No data to display') */ emptyMsg : 'No data to display', - /** + /** * @cfg {String} beforePageText * The text displayed before the input item (defaults to <tt>'Page'</tt>). */ beforePageText : 'Page', - /** + /** * @cfg {String} afterPageText * Customizable piece of the default paging text (defaults to <tt>'of {0}'</tt>). Note that * this string is formatted using <tt>{0}</tt> as a token that is replaced by the number of @@ -153,43 +167,43 @@ Ext.define('Ext.toolbar.Paging', { * total page count is desired. */ afterPageText : 'of {0}', - /** + /** * @cfg {String} firstText * The quicktip text displayed for the first page button (defaults to <tt>'First Page'</tt>). * <b>Note</b>: quick tips must be initialized for the quicktip to show. */ firstText : 'First Page', - /** + /** * @cfg {String} prevText * The quicktip text displayed for the previous page button (defaults to <tt>'Previous Page'</tt>). * <b>Note</b>: quick tips must be initialized for the quicktip to show. */ prevText : 'Previous Page', - /** + /** * @cfg {String} nextText * The quicktip text displayed for the next page button (defaults to <tt>'Next Page'</tt>). * <b>Note</b>: quick tips must be initialized for the quicktip to show. */ nextText : 'Next Page', - /** + /** * @cfg {String} lastText * The quicktip text displayed for the last page button (defaults to <tt>'Last Page'</tt>). * <b>Note</b>: quick tips must be initialized for the quicktip to show. */ lastText : 'Last Page', - /** + /** * @cfg {String} refreshText * The quicktip text displayed for the Refresh button (defaults to <tt>'Refresh'</tt>). * <b>Note</b>: quick tips must be initialized for the quicktip to show. */ refreshText : 'Refresh', - /** + /** * @cfg {Number} inputItemWidth * The width in pixels of the input field used to display and change the current page number (defaults to 30). */ inputItemWidth : 30, - /** + /** * Gets the standard paging items in the toolbar * @private */ @@ -287,7 +301,7 @@ Ext.define('Ext.toolbar.Paging', { me.callParent(); me.addEvents( - /** + /** * @event change * Fires after the active page has been changed. * @param {Ext.toolbar.Paging} this @@ -302,7 +316,7 @@ Ext.define('Ext.toolbar.Paging', { * </ul> */ 'change', - /** + /** * @event beforechange * Fires just before the active page is changed. * Return false to prevent the active page from being changed. @@ -377,7 +391,6 @@ Ext.define('Ext.toolbar.Paging', { total : totalCount, currentPage : store.currentPage, pageCount: Math.ceil(totalCount / store.pageSize), - //pageCount : store.getPageCount(), fromRecord: ((store.currentPage - 1) * store.pageSize) + 1, toRecord: Math.min(store.currentPage * store.pageSize, totalCount) @@ -416,17 +429,17 @@ Ext.define('Ext.toolbar.Paging', { // private onPagingKeyDown : function(field, e){ - var k = e.getKey(), - pageData = this.getPageData(), + var me = this, + k = e.getKey(), + pageData = me.getPageData(), increment = e.shiftKey ? 10 : 1, - pageNum, - me = this; + pageNum; if (k == e.RETURN) { e.stopEvent(); pageNum = me.readPageFromInput(pageData); if (pageNum !== false) { - pageNum = Math.min(Math.max(1, pageNum), pageData.total); + pageNum = Math.min(Math.max(1, pageNum), pageData.pageCount); if(me.fireEvent('beforechange', me, pageNum) !== false){ me.store.loadPage(pageNum); } @@ -464,63 +477,69 @@ Ext.define('Ext.toolbar.Paging', { } }, - /** + /** * Move to the first page, has the same effect as clicking the 'first' button. */ moveFirst : function(){ - var me = this; - if(me.fireEvent('beforechange', me, 1) !== false){ - me.store.loadPage(1); + if (this.fireEvent('beforechange', this, 1) !== false){ + this.store.loadPage(1); } }, - /** + /** * Move to the previous page, has the same effect as clicking the 'previous' button. */ movePrevious : function(){ var me = this, prev = me.store.currentPage - 1; - if(me.fireEvent('beforechange', me, prev) !== false){ - me.store.previousPage(); + if (prev > 0) { + if (me.fireEvent('beforechange', me, prev) !== false) { + me.store.previousPage(); + } } }, - /** + /** * Move to the next page, has the same effect as clicking the 'next' button. */ moveNext : function(){ - var me = this; - if(me.fireEvent('beforechange', me, me.store.currentPage + 1) !== false){ - me.store.nextPage(); + var me = this, + total = me.getPageData().pageCount, + next = me.store.currentPage + 1; + + if (next <= total) { + if (me.fireEvent('beforechange', me, next) !== false) { + me.store.nextPage(); + } } }, - /** + /** * Move to the last page, has the same effect as clicking the 'last' button. */ moveLast : function(){ var me = this, - last = this.getPageData().pageCount; + last = me.getPageData().pageCount; - if(me.fireEvent('beforechange', me, last) !== false){ + if (me.fireEvent('beforechange', me, last) !== false) { me.store.loadPage(last); } }, - /** + /** * Refresh the current page, has the same effect as clicking the 'refresh' button. */ doRefresh : function(){ var me = this, current = me.store.currentPage; - if(me.fireEvent('beforechange', me, current) !== false){ + if (me.fireEvent('beforechange', me, current) !== false) { me.store.loadPage(current); } }, - /** + /** * Binds the paging toolbar to the specified {@link Ext.data.Store} * @param {Store} store The store to bind to this toolbar * @param {Boolean} initial (Optional) true to not remove listeners @@ -552,7 +571,7 @@ Ext.define('Ext.toolbar.Paging', { me.store = store; }, - /** + /** * Unbinds the paging toolbar from the specified {@link Ext.data.Store} <b>(deprecated)</b> * @param {Ext.data.Store} store The data store to unbind */ @@ -560,7 +579,7 @@ Ext.define('Ext.toolbar.Paging', { this.bindStore(null); }, - /** + /** * Binds the paging toolbar to the specified {@link Ext.data.Store} <b>(deprecated)</b> * @param {Ext.data.Store} store The data store to bind */ @@ -574,4 +593,6 @@ Ext.define('Ext.toolbar.Paging', { this.callParent(); } }); -