Ext Js Grid,如何在keyup上获取单元格的值?

Ext Js Grid, How to get the value of cell on keyup?

我正在使用 Ext Js v6.2 Grid,在我的应用程序中,我需要在 keyup 上获取单元格的值这是我的代码,我已经尝试过但它没有 return值,如果我错了,请更正我的代码,我已经在文档和其他内容中进行了搜索,但 help.please 无法解决问题。提前致谢。

更新代码

    Ext.define('MisCharge', {
                    extend: 'Ext.data.Model',
                    fields: [
                        {name: 'name', mapping: 'name'},
                        {name: 'age', mapping: 'age'},
                        {name: 'marks', mapping: 'marks'}
                    ]

                });
            }


// Store data
            var myData = [
                {name: "Container Cost"},
                {name: "Packaging Cost  "},
                {name: "Handling Charges "},
                {name: "Service Cost of Buyer "},
                {name: "Documentation"},
                {name: "Cntry of origin Cert."},
                {name: "Royalties"},
                {name: "Value of Proceeds"},
                {name: "Warranty Services"},
                {name: "Seller Obligation"},
                {name: "Other Charges"},
            ];
            // Creation of first grid store
            var gridStore1 = Ext.create('Ext.data.Store', {
                model: 'MisCharge',
                data: myData,
            });
            // Creation of first grid
            var gridStore = Ext.create('Ext.grid.Panel', {
                cls: 'custom-grid',
                id: 'gridId',
                store: gridStore1,
                stripeRows: true,
                width: '100%',
                collapsible: false,
                enableColumnMove: false,
                columnLines: true,
                sortableColumns: false,
                enableColumnHide: false,
                enableColumnResize: false,
                enableRowHeightSync: true,
                columns:
                        [{
                                header: "Charges",
                                dataIndex: 'name',
                                id: 'charge',
                                width: 200,
                                height: 20,
                                flex: 1

                            },
                            {
                           editor: {
                           xtype: 'textfield',
                           enableKeyEvents: true,
                           listeners: {
                           keyup: function (form, e) {
                           var sel_model = gridStore.getSelectionModel(); 
                           var record = sel_model.getSelection()[0];
                           alert(record);
                                        }
                                    }

                                },
                                header: "Rate%",
                                dataIndex: 'age',
                                flex: 1,
                                sortable: true,
                                height: 20,
                                hideable: false,
                            },
                            {
                                editor: {
                                    xtype: 'textfield',
//                                    selectOnFocus: true
                                },
                                header: "Amount()",
                                dataIndex: 'marks',
                                flex: 1,
                                height: 20,
                                sortable: true,
                            }],
                selType: 'cellmodel',
                plugins: [
                    Ext.create('Ext.grid.plugin.CellEditing', {
                        clicksToEdit: 1
                    })]
            });

您需要通过引用 el 元素来添加事件。

editor: {
        xtype: 'textfield',
        enableKeyEvents: true,
        listeners: {
            keyup: {
                element: 'el',
                fn: function (a, b) {
                    var record = gridStore.getSelectionModel().selected.items[0].data
                    alert(record);
                }
            }
        }
    }