views:

12

answers:

1

Hi,

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

wich is called in the grid-layout:

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

the button is rendered nicely, an 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?

thanks alot!

A: 

i found the solution:

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

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

Tobias