📄 paginator-debug.js
字号:
YAHOO.util.Event.on(this.link,'click',this.onClick,this,true); this.span.id = id_base + '-last-span'; this.span.className = c; this.span.innerHTML = label; this.na.id = id_base + '-last-na'; switch (last) { case Paginator.VALUE_UNLIMITED : this.current = this.na; break; case p.getCurrentPage() : this.current = this.span; break; default : this.current = this.link; } return this.current; }, /** * Swap the link, span, and na nodes if appropriate. * @method update * @param e {CustomEvent} The calling change event (ignored) */ update : function (e) { if (e && e.prevValue === e.newValue) { return; } var par = this.current ? this.current.parentNode : null, after = this.link; if (par) { switch (this.paginator.getTotalPages()) { case Paginator.VALUE_UNLIMITED : after = this.na; break; case this.paginator.getCurrentPage() : after = this.span; break; } if (this.current !== after) { par.replaceChild(after,this.current); this.current = after; } } }, /** * Removes the link/span node and clears event listeners * @method destroy * @private */ destroy : function () { YAHOO.util.Event.purgeElement(this.link); this.current.parentNode.removeChild(this.current); this.link = this.span = null; }, /** * Listener for the link's onclick event. Passes to setPage method. * @method onClick * @param e {DOMEvent} The click event */ onClick : function (e) { YAHOO.util.Event.stopEvent(e); this.paginator.setPage(this.paginator.getTotalPages()); }};})();(function () {var Paginator = YAHOO.widget.Paginator, l = YAHOO.lang;/** * ui Component to generate the link to jump to the next page. * * @namespace YAHOO.widget.Paginator.ui * @class NextPageLink * @for YAHOO.widget.Paginator * * @constructor * @param p {Pagintor} Paginator instance to attach to */Paginator.ui.NextPageLink = function (p) { this.paginator = p; p.createEvent('nextPageLinkLabelChange'); p.createEvent('nextPageLinkClassChange'); p.subscribe('recordOffsetChange', this.update,this,true); p.subscribe('rowsPerPageChange', this.update,this,true); p.subscribe('totalRecordsChange', this.update,this,true); p.subscribe('destroy',this.destroy,this,true); // TODO: make this work p.subscribe('nextPageLinkLabelChange', this.update,this,true); p.subscribe('nextPageLinkClassChange', this.update,this,true);};/** * Decorates Paginator instances with new attributes. Called during * Paginator instantiation. * @method init * @param p {Paginator} Paginator instance to decorate * @static */Paginator.ui.NextPageLink.init = function (p) { /** * Used as innerHTML for the next page link/span. * @attribute nextPageLinkLabel * @default 'next >' */ p.setAttributeConfig('nextPageLinkLabel', { value : 'next >', validator : l.isString }); /** * CSS class assigned to the link/span * @attribute nextPageLinkClass * @default 'yui-pg-next' */ p.setAttributeConfig('nextPageLinkClass', { value : 'yui-pg-next', validator : l.isString });};Paginator.ui.NextPageLink.prototype = { /** * Currently placed HTMLElement node * @property current * @type HTMLElement * @private */ current : null, /** * Link node * @property link * @type HTMLElement * @private */ link : null, /** * Span node (inactive link) * @property span * @type HTMLElement * @private */ span : null, /** * Generate the nodes and return the appropriate node given the current * pagination state. * @method render * @param id_base {string} used to create unique ids for generated nodes * @return {HTMLElement} */ render : function (id_base) { var p = this.paginator, c = p.get('nextPageLinkClass'), label = p.get('nextPageLinkLabel'), last = p.getTotalPages(); this.link = document.createElement('a'); this.span = document.createElement('span'); this.link.id = id_base + '-next-link'; this.link.href = '#'; this.link.className = c; this.link.innerHTML = label; YAHOO.util.Event.on(this.link,'click',this.onClick,this,true); this.span.id = id_base + '-next-span'; this.span.className = c; this.span.innerHTML = label; this.current = p.getCurrentPage() === last ? this.span : this.link; return this.current; }, /** * Swap the link and span nodes if appropriate. * @method update * @param e {CustomEvent} The calling change event */ update : function (e) { if (e && e.prevValue === e.newValue) { return; } var last = this.paginator.getTotalPages(), par = this.current ? this.current.parentNode : null; if (this.paginator.getCurrentPage() !== last) { if (par && this.current === this.span) { par.replaceChild(this.link,this.current); this.current = this.link; } } else if (this.current === this.link) { if (par) { par.replaceChild(this.span,this.current); this.current = this.span; } } }, /** * Removes the link/span node and clears event listeners * @method destroy * @private */ destroy : function () { YAHOO.util.Event.purgeElement(this.link); this.current.parentNode.removeChild(this.current); this.link = this.span = null; }, /** * Listener for the link's onclick event. Passes to setPage method. * @method onClick * @param e {DOMEvent} The click event */ onClick : function (e) { YAHOO.util.Event.stopEvent(e); this.paginator.setPage(this.paginator.getNextPage()); }};})();(function () {var Paginator = YAHOO.widget.Paginator, l = YAHOO.lang;/** * ui Component to generate the link to jump to the previous page. * * @namespace YAHOO.widget.Paginator.ui * @class PreviousPageLink * @for YAHOO.widget.Paginator * * @constructor * @param p {Pagintor} Paginator instance to attach to */Paginator.ui.PreviousPageLink = function (p) { this.paginator = p; p.createEvent('previousPageLinkLabelChange'); p.createEvent('previousPageLinkClassChange'); p.subscribe('recordOffsetChange',this.update,this,true); p.subscribe('rowsPerPageChange',this.update,this,true); p.subscribe('totalRecordsChange',this.update,this,true); p.subscribe('destroy',this.destroy,this,true); // TODO: make this work p.subscribe('previousPageLinkLabelChange',this.update,this,true); p.subscribe('previousPageLinkClassChange',this.update,this,true);};/** * Decorates Paginator instances with new attributes. Called during * Paginator instantiation. * @method init * @param p {Paginator} Paginator instance to decorate * @static */Paginator.ui.PreviousPageLink.init = function (p) { /** * Used as innerHTML for the previous page link/span. * @attribute previousPageLinkLabel * @default '< prev' */ p.setAttributeConfig('previousPageLinkLabel', { value : '< prev', validator : l.isString }); /** * CSS class assigned to the link/span * @attribute previousPageLinkClass * @default 'yui-pg-previous' */ p.setAttributeConfig('previousPageLinkClass', { value : 'yui-pg-previous', validator : l.isString });};Paginator.ui.PreviousPageLink.prototype = { /** * Currently placed HTMLElement node * @property current * @type HTMLElement * @private */ current : null, /** * Link node * @property link * @type HTMLElement * @private */ link : null, /** * Span node (inactive link) * @property span * @type HTMLElement * @private */ span : null, /** * Generate the nodes and return the appropriate node given the current * pagination state. * @method render * @param id_base {string} used to create unique ids for generated nodes * @return {HTMLElement} */ render : function (id_base) { var p = this.paginator, c = p.get('previousPageLinkClass'), label = p.get('previousPageLinkLabel'); this.link = document.createElement('a'); this.span = document.createElement('span'); this.link.id = id_base + '-prev-link'; this.link.href = '#'; this.link.className = c; this.link.innerHTML = label; YAHOO.util.Event.on(this.link,'click',this.onClick,this,true); this.span.id = id_base + '-prev-span'; this.span.className = c; this.span.innerHTML = label; this.current = p.get('recordOffset') < 1 ? this.span : this.link; return this.current; }, /** * Swap the link and span nodes if appropriate. * @method update * @param e {CustomEvent} The calling change event */ update : function (e) { if (e && e.prevValue === e.newValue) { return; } var par = this.current ? this.current.parentNode : null; if (this.paginator.get('recordOffset') < 1) { if (par && this.current === this.link) { par.replaceChild(this.span,this.current); this.current = this.span; } } else { if (par && this.current === this.span) { par.replaceChild(this.link,this.current); this.current = this.link; } } }, /** * Removes the link/span node and clears event listeners * @method destroy * @private */ destroy : function () { YAHOO.util.Event.purgeElement(this.link); this.current.parentNode.removeChild(this.current); this.link = this.span = null; }, /** * Listener for the link's onclick event. Passes to setPage method. * @method onClick * @param e {DOMEvent} The click event */ onClick : function (e) { YAHOO.util.Event.stopEvent(e); this.paginator.setPage(this.paginator.getPreviousPage()); }};})();(function () {var Paginator = YAHOO.widget.Paginator, l = YAHOO.lang;/** * ui Component to generate the rows-per-page dropdown * * @namespace YAHOO.widget.Paginator.ui * @class RowsPerPageDropdown * @for YAHOO.widget.Paginator * * @constructor * @param p {Pagintor} Paginator instance to attach to */Paginator.ui.RowsPerPageDropdown = function (p) { this.paginator = p; p.createEvent('rowsPerPageOptionsChange'); p.createEvent('rowsPerPageDropdownClassChange'); p.subscribe('rowsPerPageChange',this.update,this,true); p.subscribe('rowsPerPageOptionsChange',this.rebuild,this,true); p.subscribe('destroy',this.destroy,this,true); // TODO: make this work p.subscribe('rowsPerPageDropdownClassChange',this.rebuild,this,true);};/** * Decorates Paginator instances with new attributes. Called during
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -