0

我有一个带有 actioncolumn 的网格。单击 actioncolun 时,它会显示一个包含编辑和删除项目的菜单。当我单击编辑时,它应该显示一个带有表单面板的模式弹出窗口。行数据应显示在字段中。我可以通过使用 loadRecord 方法来实现上述目标。

我正在使用的代码是

actioncolumn.on('click', function (grid, td, rowIndex, eve, e) {
                            var rec = grid.getStore().getAt(rowIndex);
                            if (!this.menu) {
                                this.menu = Ext.create('Ext.menu.Menu', {
                                    width: 100,
                                    height: 70,
                                    plain: true,
                                    floating: true,
                                    items: [{
                                        text: 'Edit',
                                        icon: 'images/Edit.png',
                                        handler: function (a, b, c, d) {
                                            var view = Ext.widget('userwindow');
                                            view.down('baseform').loadRecord(rec);
                                        }
                                    }

}

但问题是当我第二次点击编辑时,表单面板显示的是第一次加载的数据。

谁能帮忙

提前感谢

4

1 回答 1

0

我通过将记录设置为一个单独的变量来实现上述目的

actioncolumn.on('click', function (grid, td, rowIndex, eve, e) {
                           actioncolumn.rec = grid.getStore().getAt(rowIndex);
                            if (!this.menu) {
                                this.menu = Ext.create('Ext.menu.Menu', {
                                    width: 100,
                                    height: 70,
                                    plain: true,
                                    floating: true,
                                    items: [{
                                        text: 'Edit',
                                        icon: 'images/Edit.png',
                                        handler: function (a, b, c, d) {
                                            var view = Ext.widget('userwindow');
                                            view.down('baseform').loadRecord(actioncolumn.rec);
                                        }
                                    }

问候网址

于 2013-03-30T11:18:17.430 回答