从 mvc extjs 中的 rowEdit 获取记录

发布于 2025-01-01 10:20:36 字数 605 浏览 3 评论 0原文

我在 mvc 应用程序中的网格上使用 rowEditing 。当用户单击更新时,我能够处理该事件。但是我在获取所选记录时遇到问题。下面的行为很奇怪。第一次单击更新时,我没有获得 record.data.Name 值。不过我可以看到火虫的价值。 在此处输入图像描述

init: function () {

        this.control({
         'button[text=Update]': {
            click: this.onMaterialUpdate
        }
  });

},

onLaunch: function () {

},
onMaterialUpdate: function (button) {

    var grid = Ext.getCmp('materialsContainer');
    var record= grid.getSelectionModel().getSelection()[0];


    if (record != null) {
        console.log(record.data.Name);
    }
}

I'm using the rowEditing on my grid in my mvc application. I'm able to handle the event when the user clicks update. However i'm having issues get the selected record. The below behaves strangely. I do not get the record.data.Name value the first time i click update. Tho i can see the value in fire bug. enter image description here

init: function () {

        this.control({
         'button[text=Update]': {
            click: this.onMaterialUpdate
        }
  });

},

onLaunch: function () {

},
onMaterialUpdate: function (button) {

    var grid = Ext.getCmp('materialsContainer');
    var record= grid.getSelectionModel().getSelection()[0];


    if (record != null) {
        console.log(record.data.Name);
    }
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

倥絔 2025-01-08 10:20:36

不确定......但我认为单击事件发生在完成编辑之前,因此记录既没有提交,也没有在网格(或其选择)中更新。

也许尝试捕获行编辑器的编辑事件而不是单击?你应该在那里得到正确的记录?

Not sure about it... but I think the click event happens before completeEdit, thus the record is neither committed, nor updated in the grid (or its selection).

Perhaps try to capture the edit event of the row editor instead of click? You should get the correct record there?

不念旧人 2025-01-08 10:20:36

我建议处理 RowEditor 插件的编辑事件。例如,您可以在网格渲染事件上订阅此事件。通过pluginId获取插件。

I'd suggested handle edit event of the RowEditor plugin. You could subscribe to this event on grid render event for example. By getting the plugin by pluginId.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文