日期:2014-05-16 浏览次数:20726 次
{ xtype: 'itemselector', name: 'itemselector', id: 'itemselector-Yfield', anchor: '100%', height: 300, autoScroll: true, hideLabel: true, buttons: ["top", "add", "remove", "bottom"], buttonsText: { top: "添加所有项", add: "添加选中项", remove: "移除选中项", bottom: "移除所有项" }, imagePath: '@Url.Content("~/ux/css/images/")', store: itemselectStore, allowBlank: false, blankText: '@Html.GetLocalText("Common_SelectAtLeastOneDim")', //请至少选择一个可用用户和组 multiselects: [ { listTitle: '@Html.GetLocalText("WebMetaDataAccessDim")', height: 300 }, //可用用户和组 {listTitle: '@Html.GetLocalText("WebMetaDataSelectDim")', id: 'selected', height: 300}//选择用户和组 ], displayField: 'DIMmemberName', valueField: 'DIMmemberId', msgTarget: 'side' }
Ext.override(Ext.ux.form.ItemSelector, { onTopBtnClick: function () { //将top的事件改成全选的事件 var me = this, fromList = me.fromField.boundList, allRec = fromList.getStore().getRange(); fromList.getStore().remove(allRec); me.toField.boundList.getStore().add(allRec); }, onBottomBtnClick: function () { var me = this, toList = me.toField.boundList, allRec = toList.getStore().getRange(); toList.getStore().remove(allRec); me.fromField.boundList.getStore().add(allRec); } });
override: function(cls, overrides) { if (cls.prototype.$className) { return cls.override(overrides); } else { Ext.apply(cls.prototype, overrides); } }
Ext.onReady(function () { alert(Ext.ux.form.ItemSelector) });
------解决方案--------------------