javascript - 从 ExtJS 中的 GridPanel 获取模型

标签 javascript extjs combobox extjs4 gridpanel

我有一个网格面板,允许对列进行内联编辑。此列使用组合框作为编辑器,“更改”事件和“选择”事件都没有为我提供可用于回溯编辑值以从网格面板获取更改行的内容。

我相信 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/

相关文章:

javascript - 在异步函数中调用函数(渲染组件)

javascript - Angularjs - 网址参数 : When clicked returns to angular vars in the url

python - 如何在 wxPython ComboBox 中存储字符串以外的对象?

javascript - 如何从 ExtJS5 中的存储中获取字段

c# - 使用 "combobox with checkbox"在组合框中显示选中的项目

c# - Silverlight 组合框空项目高度

javascript - 联系表格 7 : display/hide div on selection

javascript - React Context API,更新上下文

javascript - 更改 Ext.js TreePanel 复选框元素

ajax - ExtJS 4 - 如何检查当前所有ajax请求是否已完成然后执行操作?