Opened 9 years ago

Closed 9 years ago

#11393 closed defect (worksforme)

Datagrid / JsonRestStore delete refresh bug

Reported by: zladivliba Owned by: Bryan Forbes
Priority: blocker Milestone: tbd
Component: DojoX Grid Version: 1.4.0
Keywords: Cc:
Blocked By: Blocking:

Description

The grid doesn't refresh it's content when I delete an item from a JsonRestStore?.

Each time I delete an item on the JsonRestStore?, the item is indeed deleted on the server (the DELETE request is executed) but the item stays inside the grid (untill next page refresh).

I haven't tested yet my code with another datastore but what I wrote is very simple and after discussion on Irc I really don't thnik the problems come from here.

Here's the code :

dojo.addOnLoad(function(){

When user clicks show the details of the item dojo.connect(OpportunityGrid?, "onRowClick", function(e) {

Grid AD.item = OpportunityGrid?.getItem(e.rowIndex); AD.UpdateContent?();

dojo.byId("MenuDelete?").innerHTML = '<a href="javascript:deleteItem('+ OpportunityGrid?.getItem(e.rowIndex).id + ');"> Delete</a>';

});

When the page is loaded show the details of the first item on the grid dojo.connect(OpportunityGrid?, "_onFetchComplete", function(items){

Grid AD.item = OpportunityGrid?.getItem(0); AD.UpdateContent?();

});

});

========= This function is called by the user and deletes the item on the server (DELETE request) but not on the client

function deleteItem(value){

OpportunitiesStore?.fetchItemByIdentity({

identity: value, onItem: function(item,request){

Tsk = item; OpportunitiesStore?.deleteItem(Tsk); OpportunitiesStore?.save();

}

});

}

</script>

Here's my grid.

<span dojoType="dojox.data.JsonRestStore?" jsId="OpportunitiesStore?" target="/opportunities/" idAttribute="id" ></span> <table dojoType="dojox.grid.DataGrid?" store="OpportunitiesStore?" jsId="OpportunityGrid?" style="width:100%; height:130px;" clientsort="true">

<thead>

<tr>

<th field="Account" width="13%">Account</th> <th field="id" width="5%" formatter="formatDel">Delete</th>

</tr>

</thead>

</table>

Attachments (1)

test_11393.html (2.3 KB) - added by evan 9 years ago.
Sample test case in which grid.removeSelectedRows() or jsonRestStore.deleteItem() works correctly

Download all attachments as: .zip

Change History (4)

comment:1 Changed 9 years ago by zladivliba

Adding OpportunityGrid?.sort(); is a possible way to solve this bug.

However the datagrid docs explain clearely that it should refresh automatically after item deletion.

comment:2 Changed 9 years ago by bill

Owner: changed from bryanforbes to Bryan Forbes

comment:3 Changed 9 years ago by evan

Resolution: worksforme
Status: newclosed

Not reproduced with trunk on FF3.5+/IE6+/Safari 5/Chrome 6+

Deleting row items by either grid.removeSelectedRows() or jsonRestStore.deleteItem() works correctly - as tested in the attached test_#11393.html[BR]]

We can reopen this if any more tips provided to help reproduce.

Changed 9 years ago by evan

Attachment: test_11393.html added

Sample test case in which grid.removeSelectedRows() or jsonRestStore.deleteItem() works correctly

Note: See TracTickets for help on using tickets.