【发布时间】:2016-02-17 01:47:33
【问题描述】:
我在将数据从网格加载到 Extjs 4 中的表单时遇到问题。
我正在尝试将字段 vid 发送到表单,只是为了测试,但我什至不能这样做。找到了很多例子,尝试了这些想法。做不到。
数据来自mongodb。
我可以完美地在网格中显示它。
现在我想点击编辑按钮打开一个带有表单的窗口并显示信息。
我错过了什么?
Ext.define('DevJS.view.users.List', {
extend: 'Ext.grid.Panel',
autoHeight: true,
forceFit: true,
this.columns = [
{text: 'Id', dataIndex: '_id', hidden: true},
{
text: 'Vid',
dataIndex: 'vid',
autoSizeColumn: true
}
...
xtype: 'actioncolumn',
autoSizeColumn: true,
items: [
{
iconCls: 'button-edit',
tooltip: 'Edit',
handler: function (grid, rowIndex, colIndex) {
this.up('grid').fireEvent('editRow', grid, rowIndex, colIndex);
}
},
{
iconCls: 'button-info',
itemId: 'Comments',
text: 'Comments',
handler: function (grid, rowIndex, item) {
alert(rowIndex)
win.record = rowIndex;
win.show()
}
}
]
}
];
//parent
this.callParent(arguments);
}
});
var form = new Ext.form.FormPanel({
title : 'Test form',
id:'form',
width : 300,
items : [{
xtype: 'textfield',
editable:false,
fieldLabel: 'vid',
name: 'vid'
}]
});
var win = new Ext.Window({
title : 'test',
items : [{
xtype : 'panel',
layout : 'column',
items : [form]
}],
listeners:{
afterrender:function(window) {
if(window.record) window.down('form').loadRecord(window.record);
}
}
});
【问题讨论】:
标签: javascript node.js mongodb extjs