开发者

dojox - Datangrid with jsonRestStore - Delete button

I have a dojox.grid.datagrid connected to an dojox.data.jsonreststore. everything works fine, but I cant get the delete-button to work:

I have a formatter-function:

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" />';
    }

which is called in the grid-layout:

{"field":"id","width":"25p开发者_Python百科x","formatter":getDelete,"styles":"text-align:center;vertical-align:middle;","name":" "},

The button is rendered nicely, and when I click on it, the warning message is displayed - but the item is not deleted!

If I ran:

store.deleteItem(106);

manually I get an "undefined" back. If I try to get an item from the id with:

store.fetchItemByIdentity(106);

to delete that, there is a TypeError: Cannot call method 'toString' of undefined

Maybe someone can point me to an solution?


i found the solution:

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

fetchItemByIdentity needs not just the identity... hope this is helpful to anyone...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜