【问题标题】:dojox - Datangrid with jsonRestStore - Delete buttondojox - 带有 jsonRestStore 的 Datangrid - 删除按钮
【发布时间】:2011-04-30 10:45:08
【问题描述】:

我有一个连接到 dojox.data.jsonreststore 的 dojox.grid.datagrid。一切正常,但我无法让删除按钮工作:

我有一个格式化函数:

function getDelete(item) {
    var url = "if (confirm('Sind Sie sicher, das der Eintrag gelöscht werden soll? Diese Aktion kann nicht Rückgängig gemacht werden!')) { store.deleteItem(" + item + "); store.save(); }";
    return '<img onclick="' + url + '" src="/images/remove.png" width="20px" />';
    }

在网格布局中调用:

{"field":"id","width":"25px","formatter":getDelete,"styles":"text-align:center;vertical-align:middle;","name":" "},

按钮渲染得很好,当我点击它时,会显示警告消息 - 但该项目没有被删除!

如果我跑了:

store.deleteItem(106);

我手动返回“未定义”。 如果我尝试从 id 获取项目:

store.fetchItemByIdentity(106);

要删除它,有一个 TypeError: Cannot call method 'toString' of undefined

也许有人可以指出一个解决方案?

【问题讨论】:

    标签: datagrid dojo


    【解决方案1】:

    我找到了解决方案:

    store.deleteItem(store.fetchItemByIdentity({identity: '106'})); 
    

    fetchItemByIdentity 不仅需要身份...希望这对任何人都有帮助...

    【讨论】:

      猜你喜欢
      • 2011-04-28
      • 1970-01-01
      • 2023-03-24
      • 2020-06-22
      • 1970-01-01
      • 1970-01-01
      • 2011-11-07
      • 1970-01-01
      • 2013-02-09
      相关资源
      最近更新 更多