Ext.js将列添加到属性网格中
Ext.js add column to property grid
如何在属性网格中添加列?到目前为止,我已经尝试了以下几种:
source : dataForGrid.source,
columns : [
{
text: 'text',
xtype : 'checkcolumn',
dataIndex : 'status',
width : 100,
editor : {
xtype : 'checkbox'
},
listeners : {
checkchange : function (checkColumn, rowIndex, checked, eOpts ) {
//some code here
}
},
renderer: function(val, m, rec, rowIndex) {
//some code here
}
},
{
text: 'TEST',
sortable: false,
dataIndex: 'value2',
field: {
xtype: 'textfield'
}
}
],
customEditors: dataForGrid.customEditors,
我的源代码非常标准,我有一个tempObj开关,它包含以下属性(dataForGrid被传递到网格的源属性):
tempObj.name = data[i].some;
tempObj.text = data[i].some === '' ? '' : '<a class="clientNameTextSomeGrid" onclick="console.log(123)">' + data[i].some + '</a>';
tempObj.editor = data[i].someother;
tempObj.datatype = 'nvarchar';
tempObj.editable = true;
tempObj.status = data[i].someother === 'A' ? true : false;
tempObj.renderer = "";
tempObj.value2 = "gcgrg";
dataForGrid.source.push(tempObj);
我有一个客户编辑:
var newField = Ext.create('Ext.form.ComboBox', {
name: data[i].some,
store: tempStore,
clientID: tempObj.editor,
queryMode: 'local',
editable: false,
displayField: 'value',
valueField: 'id',
triggerAction: 'all'
});
dataForGrid.customEditors[data[i].some] = new Ext.grid.CellEditor({
field: newField
});
复选框(以及使用customEditors的组合框)工作正常。但我无法将值添加到"TEST"列(该列出现,但其中没有值)。任何帮助都将不胜感激。如果您有问题或需要更多代码,请在下面写一条评论,我们会提供。
*更新:如果第二列的dataIndex属性包含"status"值(来自tempObj),则该列将使用特定值进行渲染,但如果我再次使用tempObj的value2属性,该列将保持为空。
我们实现这一点的方法是扩展模型:
Ext.define('Ext.ux.grid.property.Property', {
extend: 'Ext.data.Model',
idProperty: 'name',
fields: [
{
name: 'name',
type: 'string'
},
{
name: 'text',
type: 'string'
},
{
name: 'value'
},
{
name: 'editor' // custom editor
},
{
name: 'group', // for grouping
type: 'string'
},
{
name: 'editable',
type: 'boolean',
defaultValue: true
},
{
name: 'status',
type: 'boolean'
},
{
name: 'renderer', // custom renderer
defaultValue: null
},
//////////////////////////////////////
// custom fields begin here
// Custom Properties grid
{
name: 'someName',
type: 'string'
}
]
});
然后来源变成了:
tempObj.name = data[i].some;
tempObj.text = data[i].some === '' ? '' : '<a class="clientNameTextSomeGrid" onclick="console.log(123)">' + data[i].some + '</a>';
tempObj.editor = data[i].someother;
tempObj.datatype = 'nvarchar';
tempObj.editable = true;
tempObj.status = data[i].someother === 'A' ? true : false;
tempObj.renderer = "";
tempObj.someName = "Something in here";
dataForGrid.source.push(tempObj);
相关文章:
- 使用导航属性创建Kendo UI网格模型的问题
- Extjs 3.4 中属性网格行值的工具提示 /Qtip(鼠标悬停)
- Ext.js将列添加到属性网格中
- 在剑道网格中,我可以用一个函数动态设置列属性吗
- 将列表的css列计数属性相应地绑定到引导网格类
- 无法设置属性'网格'的未定义
- 剑道网格分组列 - 类型错误:无法读取未定义的属性“长度”
- 在网格视图中获取属性“行”时出错
- 将属性添加到复选框后退网格
- 检索网格视图中复选框的选中属性
- 剑道网格 - 单击“添加新行”按钮后,获取剑道网格未捕获的类型错误:无法读取“名称”空的属性
- 访问网格数据存储的加载函数内的sortInfo属性
- 使用多种材质渲染网格时无法读取 undef 的属性“均匀”
- 从实体主页(网格视图)检索实体属性
- Kendo UI网格-单元格上的标题属性
- "无法读取属性'选项'未定义的“;尝试更新数据网格时的EasyUI
- Kendo序列化的Javascript数组网格对象属性在服务器上为null
- Extjs:访问链接在窗口中的属性网格
- 设置属性网格's标头可见
- ExtJS操作属性网格源信息