赞
踩
var data = {users:[ {mid:'1',mname:'非诚勿扰'}, {mid:'2',mname:'让子弹飞'}, {mid:'3',mname:'锦衣卫'}, {mid:'4',mname:'狄仁杰4'} ]} var store = new Ext.data.Store({ fields:['mname','mid'], data : data, proxy: { type: 'memory', reader: { type: 'json', root: 'users' } } }); //combox弹出 var grid = new Ext.grid.GridPanel({ width:100, height: 200, store: store, viewConfig:{ forceFit:true }, columns:[{header:'姓名',dataIndex:'mname',width: 90} ], selType:'checkboxmodel',//设定选择模式 multiSelect:true,//运行多选 dockedItems: [{ xtype: 'toolbar', dock: 'bottom', items: [ {xtype: 'button', text: '确定',handler:function(){ var m = grid.getSelectionModel().getSelection(); var ids = []; for(var i=0;i<m.length;i++){ ids.push(m<i>.get('id')); }grid.hide()}}, {xtype: 'button', text: '取消',handler:function(){ grid.hide(); }} ] }] }); var showMenu = new Ext.menu.Menu({ items : [grid] }); panel = Ext.create('Ext.form.Panel', { title: '按条件搜索', width: 600, height:100, defaultType: 'textfield', frame: true, method: 'POST', collapsible: true,//可折叠bodyPadding: 5, layout: 'column', margin: '0 0 0 0', items: [{ fieldLabel: '姓名', margin: '0 0 20 20', labelWidth: 40, labelAlign:'right', id: 'name' },{ xtype: 'combo', labelWidth: 40, fieldLabel: '测试', store:new Ext.data.ArrayStore({ fields: ['mid','mname'], data:[[]] }), id: "combo1", queryMode: 'local', valueField: 'mid', displayField: 'mname', listeners:{ expand:function(combo){ if(this.menu == null) { this.menu = showMenu; store.load(); }else{ grid.show(); } this.menu.showBy(this.el ); } } }); } }]
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。