X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/2e847cf21b8ab9d15fa167b315ca5b2fa92638fc..6a7e4474cba9d8be4b2ec445e10f1691f7277c50:/examples/ux/gridfilters/menu/ListMenu.js diff --git a/examples/ux/gridfilters/menu/ListMenu.js b/examples/ux/gridfilters/menu/ListMenu.js index 4687d25b..a6fe81aa 100644 --- a/examples/ux/gridfilters/menu/ListMenu.js +++ b/examples/ux/gridfilters/menu/ListMenu.js @@ -1,177 +1,177 @@ /*! - * Ext JS Library 3.1.1 - * Copyright(c) 2006-2010 Ext JS, LLC + * Ext JS Library 3.2.0 + * Copyright(c) 2006-2010 Ext JS, Inc. * licensing@extjs.com * http://www.extjs.com/license */ -Ext.namespace('Ext.ux.menu'); - -/** - * @class Ext.ux.menu.ListMenu - * @extends Ext.menu.Menu - * This is a supporting class for {@link Ext.ux.grid.filter.ListFilter}. - * Although not listed as configuration options for this class, this class - * also accepts all configuration options from {@link Ext.ux.grid.filter.ListFilter}. - */ -Ext.ux.menu.ListMenu = Ext.extend(Ext.menu.Menu, { - /** - * @cfg {String} labelField - * Defaults to 'text'. - */ - labelField : 'text', - /** - * @cfg {String} paramPrefix - * Defaults to 'Loading...'. - */ - loadingText : 'Loading...', - /** - * @cfg {Boolean} loadOnShow - * Defaults to true. - */ - loadOnShow : true, - /** - * @cfg {Boolean} single - * Specify true to group all items in this list into a single-select - * radio button group. Defaults to false. - */ - single : false, - - constructor : function (cfg) { - this.selected = []; - this.addEvents( - /** - * @event checkchange - * Fires when there is a change in checked items from this list - * @param {Object} item Ext.menu.CheckItem - * @param {Object} checked The checked value that was set - */ - 'checkchange' - ); - - Ext.ux.menu.ListMenu.superclass.constructor.call(this, cfg = cfg || {}); - - if(!cfg.store && cfg.options){ - var options = []; - for(var i=0, len=cfg.options.length; i -1, - hideOnClick: false}); - - item.itemId = records[i].id; - item.on('checkchange', this.checkChange, this); - - this.add(item); - } - - this.loaded = true; - - if (visible) { - this.show(); - } - this.fireEvent('load', this, records); - }, - - /** - * Get the selected items. - * @return {Array} selected - */ - getSelected : function () { - return this.selected; - }, - - /** @private */ - setSelected : function (value) { - value = this.selected = [].concat(value); - - if (this.loaded) { - this.items.each(function(item){ - item.setChecked(false, true); - for (var i = 0, len = value.length; i < len; i++) { - if (item.itemId == value[i]) { - item.setChecked(true, true); - } - } - }, this); - } - }, - - /** - * Handler for the 'checkchange' event from an check item in this menu - * @param {Object} item Ext.menu.CheckItem - * @param {Object} checked The checked value that was set - */ - checkChange : function (item, checked) { - var value = []; - this.items.each(function(item){ - if (item.checked) { - value.push(item.itemId); - } - },this); - this.selected = value; - - this.fireEvent('checkchange', item, checked); - } +Ext.namespace('Ext.ux.menu'); + +/** + * @class Ext.ux.menu.ListMenu + * @extends Ext.menu.Menu + * This is a supporting class for {@link Ext.ux.grid.filter.ListFilter}. + * Although not listed as configuration options for this class, this class + * also accepts all configuration options from {@link Ext.ux.grid.filter.ListFilter}. + */ +Ext.ux.menu.ListMenu = Ext.extend(Ext.menu.Menu, { + /** + * @cfg {String} labelField + * Defaults to 'text'. + */ + labelField : 'text', + /** + * @cfg {String} paramPrefix + * Defaults to 'Loading...'. + */ + loadingText : 'Loading...', + /** + * @cfg {Boolean} loadOnShow + * Defaults to true. + */ + loadOnShow : true, + /** + * @cfg {Boolean} single + * Specify true to group all items in this list into a single-select + * radio button group. Defaults to false. + */ + single : false, + + constructor : function (cfg) { + this.selected = []; + this.addEvents( + /** + * @event checkchange + * Fires when there is a change in checked items from this list + * @param {Object} item Ext.menu.CheckItem + * @param {Object} checked The checked value that was set + */ + 'checkchange' + ); + + Ext.ux.menu.ListMenu.superclass.constructor.call(this, cfg = cfg || {}); + + if(!cfg.store && cfg.options){ + var options = []; + for(var i=0, len=cfg.options.length; i -1, + hideOnClick: false}); + + item.itemId = records[i].id; + item.on('checkchange', this.checkChange, this); + + this.add(item); + } + + this.loaded = true; + + if (visible) { + this.show(); + } + this.fireEvent('load', this, records); + }, + + /** + * Get the selected items. + * @return {Array} selected + */ + getSelected : function () { + return this.selected; + }, + + /** @private */ + setSelected : function (value) { + value = this.selected = [].concat(value); + + if (this.loaded) { + this.items.each(function(item){ + item.setChecked(false, true); + for (var i = 0, len = value.length; i < len; i++) { + if (item.itemId == value[i]) { + item.setChecked(true, true); + } + } + }, this); + } + }, + + /** + * Handler for the 'checkchange' event from an check item in this menu + * @param {Object} item Ext.menu.CheckItem + * @param {Object} checked The checked value that was set + */ + checkChange : function (item, checked) { + var value = []; + this.items.each(function(item){ + if (item.checked) { + value.push(item.itemId); + } + },this); + this.selected = value; + + this.fireEvent('checkchange', item, checked); + } }); \ No newline at end of file