我有一个网格面板,允许对列进行内联编辑。此列使用组合框作为编辑器,“更改”事件和“选择”事件都没有为我提供可用于回溯编辑值以从网格面板获取更改行的内容。
我相信 Ext 会 float 编辑器的组合框,因此我不能做一些简单的事情
combo.up()
返回网格。
这是 View 中的网格面板:
{
xtype: 'gridpanel',
title: 'Important Projects',
id: 'importantProjectsGrid',
dockedItems: [],
flex: 1,
columns: [
{ header: 'Quote Name', dataIndex: 'QuoteName', flex: 4 },
{ header: 'Quote Status', dataIndex: 'QuoteStatusID', flex: 6, editor: {
xtype: 'combobox',
editable: false,
action: 'QuoteStatus',
selectOnTab: true,
store: 'statuses',
queryMode: 'local',
displayField: 'Description',
valueField: 'Description'
} }
],
store: 'myimpprojects',
selModel: {
selType: 'cellmodel'
},
plugins: [Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
})]
}
这是与此相关的 Controller 代码:
init: function () {
this.control({
'[action=QuoteStatus]': {
change: function (combo, new_value, old_value, opts) {
// I need to go back up from this combobox
// to get the row that this value was edited in
// to grab an ID value from that row's data
// in order to make an ajax request
}
}
});
},
感谢您的帮助!
最佳答案
您可以监控商店的update
事件。
init: function () {
this.getMyimpprojectsStore().on('update', function(store, record) {
// do something with record
});
// ...
},
关于javascript - 从 ExtJS 中的 GridPanel 获取模型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9281452/