欢迎您访问我爱IT技术网,今天小编为你分享的javascript教程:【Extjs EditorGridPanel中ComboBox列的显示问题】,下面是详细的讲解!
Extjs EditorGridPanel中ComboBox列的显示问题
//部门列表
var comboxDepartmentStore=new Ext.data.Store({
proxy: new Ext.data.HttpProxy({
url: "GetDepartmentJson.aspx",
method: 'GET'
}),
reader: new Ext.data.JsonReader({
root: 'data',
totalProperty: 'totalCount',
fields: [
{ name: 'departmentid', mapping: 'ID' },
{ name: 'departmentname', mapping: 'Name' }
]
})
});
//根据Combobox列表中对应的Id的值来渲染
function rendererMeterTypeCombobox(value, p, r) {
var index=comboxDepartmentStore.find(Ext.getCmp('cbdepartment').valueField, value);
var record=comboxDepartmentStore.getAt(index);
var displayText="";
if (record==null) {
return value;
} else {
return record.data.astype; // 获取record中的数据集中的display字段的值
}
}
var sm=new Ext.grid.CheckboxSelectionModel();
var cm=new Ext.grid.ColumnModel({
columns: [sm, new Ext.grid.RowNumberer(), {
header: 'id',
dataIndex: 'id',
hidden: true
}, {
header: '姓名',
width: 40,
dataIndex: 'name'
}, {
header: '所属部门',
width: 80,
dataIndex: 'department',
renderer: rendererDepartmentCombobox,
editor: new Ext.form.ComboBox({
id: "cbdepartment", //必须有
forceSelection: true,
selectOnFocus: true,
typeAhead: true,
triggerAction: 'all',
store: comboxDepartmentStore,
mode: 'local',
displayField: 'departmentname',
valueField: 'departmentid',
lazyRender: true
})
}],
defaults: {
zsortable: true,
menuDisabled: false,
width: 100
}
});
var editGrid=new Ext.grid.EditorGridPanel({
id: 'TestGrid',
store: store, //EditorGridPanel使用的store
trackMouseOver: true,
disableSelection: false,
clicksToEdit: 1, //设置点击几次才可编辑
loadMask: true,
autoHeight: true,
cm: cm,
sm: sm,
viewConfig: {
columnsText: '显示/隐藏列',
sortAscText: '正序排列',
sortDescText: '倒序排列',
forceFit: true,
enableRowBody: true
},
bbar: new Ext.PagingToolbar({
pageSize: 25,
store: store,
displayInfo: true,
displayMsg: '当前显示从{0}至{1}, 共{2}条记录',
emptyMsg: "当前没有记录"
})
});
关于Extjs EditorGridPanel中ComboBox列的显示问题的用户互动如下:
相关问题:Extjs grid里某个column的xtype为combobox,怎样在...
答:ComboBox 定义有问题。你的 MyPanel 是 Ext.panel.Panel 还是 Ext.panel.Grid ? var combo = Ext.create('Ext.form.field.ComboBox', { displayField : 'name', valueField : 'code', editable : false, store : comboStore, labelAlign : 'righ... >>详细
相关问题:extjs 表格编辑,动态显示列怎么弄?
答:这里说的应该是excel动态图表下拉显示列,操作方法如下: 1.制作包含了相关数据的Excel表格,以下以一份销售简表为例,说明该技巧的详细思路。 2.选择单元格A20(也可以是其他空白单元格),单击菜单栏“数据”→有效性”,打开“数据有效性”对话框,... >>详细
相关问题:请问,extjs中怎样才能动态的设置EditorGridPanel...
答:对,就是用 beforeedit。 比如表里只有你说的三个字段,并且顺序为 direct , load, credit listeners : { beforeedit : function(editor, e) { if(e.colIdx== 1 && e.record.data.direct == 0)){ return true; }else if(e.colIdx == 2 && e.reco... >>详细
- 【firefox】firefox浏览器不支持innerText的解决
- 【Extjs】Extjs学习过程中新手容易碰到的低级错误
- 【dom】javascript dom追加内容实现示例-追加内容
- 【checkbox】让checkbox不选中即将选中的checkbox
- 【Array】js中更短的 Array 类型转换-类型转换
- 【append】append和appendTo的区别以及appendChil
- 【ExtJs】ExtJs 表单提交登陆实现代码-表单提交-
- 【addClass】javascript自定义的addClass()方法
- 【Event】jquery下为Event handler传递动态参数的
- 【Ajax】jQuery 学习第六课 实现一个Ajax的TreeVi
- 评论列表(网友评论仅供网友表达个人看法,并不表明本站同意其观点或证实其描述)
-
