Combox下拉GridPanel菜单
extjs Combox下拉GridPanel菜单
Ext.onReady(function(){
Ext.BLANK_IMAGE_URL = wroot+'ext-3.2.0/resources/images/default/s.gif';
//
var data=[['1','非诚勿扰'],['2','让子弹飞'],['3','锦衣卫'],['4','狄仁杰4']];
// 控制gridpanel 列表行 为只能选择一行
var rsm = new Ext.grid.RowSelectionModel({ singleSelect:true });
var store = new Ext.data.Store({
autoDestroy: true,
proxy:new Ext.data.MemoryProxy(data),
reader:new Ext.data.ArrayReader({},[
{name:'mid'},
{name:'mname'}
])
});
var grid = new Ext.grid.GridPanel({
width:600,
height: 200,
frame: true,
border:true,
//enableHdMenu:false,
store: store,
enableColumnMove:false, //支持列移动
enableColumnResize:true,
autoExpandColumn : true,
trackMouseOver : true,
viewConfig:{
forceFit:true
},
sm:rsm ,
tbar:[{text:'确定一'},'-',new Ext.form.TextField({id: 'paramCnName',width:60}),{text:'查找一'}],
cm: new Ext.grid.ColumnModel([
new Ext.grid.RowNumberer(),
{header:'编号',dataIndex:'mid', sortable: true},
{header:'姓名',dataIndex:'mname', sortable: true}
]),
// 远程数据 才有效果
bbar:new Ext.PagingToolbar({
pageSize:10,
store:store,
displayInfo:true,
displayMsg:'显示第{0} 条 到 {1} 条记录,一共{2}条',
emptyMsg:'无记录'
}),
listeners:{
rowdblclick:function(grid , rowIndex ,e){
showMenu .hide();
var rowOptions = grid.getSelectionModel().getSelections();
for(var i=0; i< rowOptions.length; i++){
var uid = rowOptions[i].get('mid');
var uname = rowOptions[i].get('mname');
comb.setValue(uid);
comb.setRawValue(uname);
}
}
}
});
var showMenu = new Ext.menu.Menu({
items : [grid]
});
var comb = new Ext.form.ComboBox({
renderTo:'combox-panel-grid', /*渲染到一个容器里*/
width:600,
triggerAction: 'all',
typeAhead: true,
lazyRender:true,
editable:true,
emptyText:'请选择...',
 
相关新闻>>
- 发表评论
-
- 最新评论 更多>>