views:

12

answers:

0

Hi,

as long as i know, the dojox.grid.datagrid should be "data aware" wich means, if i delete an item from the jsonreststore, it should get deleted from the datagrid too...

but - the grid is updated only if there is an error in the json-resonse from the delete-Request. If i return 204 as status code, nothing happens (in the grid, the data is beeing deleted on the server successfully).

any hints how i can update the grid?

here is my store, and my grid:

store = new dojox.data.JsonRestStore({"idAttribute":"id","target":"\/model\/controller"});

listGridLayout = [{"field":"id","width":"25px","formatter":getEdit,"styles":"text-align:center;vertical-align:middle;","name":" "},
        {"field":"id","width":"25px","formatter":getDelete,"styles":"text-align:center;vertical-align:middle;","name":" "},
        {"field":"id","width":"30px;","styles":"text-align:center;height:25px;","name":"ID"}, ...

listGridGrid = new dojox.grid.DataGrid({"selectionMode":"single","store":store,"rowsPerPage":30,"rowSelector":"0px","singleClickEdit":1,"style":"width:98%; height: 97%","id":"listGrid","structure":listGridLayout}), document.createElement('div');
    dojo.byId("listGrid").appendChild(listGridGrid.domNode);
    listGridGrid.startup();
    dojo.connect(listGridGrid, "onApplyEdit", function(row){        store.save();});
    dojo.connect(listGridGrid, "onSelected", function(item, attribute, oldValue, newValue){        store.save();});

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(store.fetchItemByIdentity({identity: '" + item + "'})); }";
    return '<img onclick="' + url + '" src="/images/remove.png" width="20px" />';
    }