1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
| { xtype: 'combobox', name: 'type', fieldLabel: '更改类别', labelAlign: "right", labelSeparator: "", labelWidth: 80, editable: false, margin: "5, 0, 0, 0", multiSelect: true, createPicker: function () { var self = this; var store = new Ext.data.TreeStore({ fields: ['id', 'text'], autoLoad: true, autoDestroy: true, proxy: { type: 'ajax', actionMethods: { read: 'POST' }, url: me.URL('xxx/xx/xx') }, root: { expanded: true, children: [] }, listeners: { beforeload: function (store, eOpts) { self.getEl().mask("加载中..."); }, load: function (store, eOpts) { self.getEl().unmask(); } } }); var picker = new Ext.tree.Panel({ xtype: 'check-tree', width: 100, height: 'auto', store: store, pickerField: self, rootVisible: false, floating: true, hidden: true, checkable: true, checkModel: 'cascade', triggerOnClick: true, viewConfig: { focusOnToFront: true }, border: 0, cls: 'PSI-Msgbx-tip', listeners: { scope: self, itemclick: function (view, record, node, rowIndex, e) { record.set('checked', !record.get('checked'));
// 获取当前选中的所有节点 var checkedNodes = picker.getChecked(), nodeTexts = []; Ext.Array.each(checkedNodes, function(node) { nodeTexts.push(node.get('text')); });
// 设置combobox的值为所有选中节点的文本 self.setValue(nodeTexts.join(', ')); } }, buttons: [{ text: '确定', handler: function() { self.collapse(); } }] });
self.mon(picker, { show: function () { store.load(); }, afteritemexpand: self.alignPicker, afteritemcollapse: self.alignPicker, scope: self });
return picker; } }
|