Extjs 2.3 的多選框控制元件 muiltiCombox
阿新 • • 發佈:2019-01-07
在製作報表的查詢條件時,需要有多選下拉框,Ext 2.3預設沒有實現。找來參考資料1的程式碼測試,發現當有多個多選下拉框時,會有資料混亂不能選擇的情況。對其中原始碼進行了修正,現在可以正常使用。主要修改了初始化[this.selections初始化]和setValue()函式,原始碼如下:
/** * 程式碼Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->Ext.ns('Ext.ux'); * http://www.cnblogs.com/damnedmoon/archive/2010/05/11/1732389.html */ Ext.ux.MultiComBox = Ext.extend(Ext.form.ComboBox, { splitSign : ',', selections : [], checks : [], hiddenValue : '', lastSelectionText : '', initList : function() { var cls = 'x-combo-list'; this.tpl = '<div class="" '"="">
{' + this.displayField + '} |
items : [ { xtype : 'multiCombox', fieldLabel : '多選資料', id : 'p_data', name : 'p_data', anchor : '95%', triggerAction : 'all', valueField : 'name', displayField : "name", readOnly : true, store : dataStore, mode : 'remote' } ]
預覽效果如圖:
參考資料:
[1]Ext JS多選控制元件 MultiCombo.http://www.cnblogs.com/damnedmoon/archive/2010/05/11/1732389.html