Opened 11 years ago
Closed 10 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)
Change History (4)
comment:1 Changed 11 years ago by
comment:2 Changed 10 years ago by
Owner: | changed from bryanforbes to Bryan Forbes |
---|
comment:3 Changed 10 years ago by
Resolution: | → worksforme |
---|---|
Status: | new → closed |
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 10 years ago by
Attachment: | test_11393.html added |
---|
Sample test case in which grid.removeSelectedRows() or jsonRestStore.deleteItem() works correctly
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.