Opened 8 years ago

Closed 6 years ago

#12703 closed defect (wontfix)

duplicates are shown after add items to DataGrid when used with ClientFilter and JsonRestStore

Reported by: ant Owned by: Kris Zyp
Priority: blocker Milestone: tbd
Component: DojoX Data Version: 1.4.3
Keywords: Cc:
Blocked By: Blocking:

Description

I have having some problems with adding items to DataGrid? when used with ClientFilter? and JsonRestStore?. It sounds similar to another ticket (#7743).

I am using Dojo 1.4.3 (21629). The problem is happening in all browsers I use(IE 8.06001.18702, Firefox 3.6.16, Chrome 10.0.648.204). OS is Windows XP SP 3.

dojo.require("dojox.grid.DataGrid?"); dojo.require("dojox.data.ClientFilter?"); dojo.require("dojox.data.JsonRestStore?");

resourceStore = new dojox.data.JsonRestStore?({

target: targetURL, labelAttribute: "id", idAttribute: "id"

});

resourceGrid = new dojox.grid.DataGrid?({

store: resourceStore, structure: resourceGridLayout, selectionMode: "single", queryOptions:{cache:true, ignoreCase: true}, clientSort: true, rowsPerPage: 5, sortFields:[{attribute:'name'},{attribute:'version'}], updateDelay: 0, onSelectionChanged : function(){

var selected = resourceGrid.selection.getSelected(); dojo.publish("resource_selection_changed", [selected[0]]);

}

});

Problem: If I add a item to the grid above,duplicate items will show in the datagrid on every 5th row. In this example, I have added a new resource named “00” and in the datagrid, the items 5th row and the 10th row … are replaced by a duplicate of the newly added item. Please see the attachment picture named “after_add). Actually, if I change the resourceGrid.rowsPerPage property to a different number, let say X, a duplicate will show on every Xth row in the grid. Note that there is only one item add request sent to the server and inserted to the database. Clicking on columns to resort does not help. However, if I refresh the page, the datagrid will display properly again.

The add button leads to the following code

item = resourceStore.newItem(json_data);

resourceStore.save({

onError: function(e){

resourceDialog.hide();

}, onComplete: function(){

resourceDialog.hide(); resourceGrid.filter({},true); resourceGrid.sort();

}

Attachments (2)

before_add.PNG (6.6 KB) - added by ant 8 years ago.
datagrid before adding new item
after_add.PNG (6.7 KB) - added by ant 8 years ago.
datagrid after adding new item

Download all attachments as: .zip

Change History (7)

Changed 8 years ago by ant

Attachment: before_add.PNG added

datagrid before adding new item

Changed 8 years ago by ant

Attachment: after_add.PNG added

datagrid after adding new item

comment:1 Changed 8 years ago by ant

Note: I have also create another ticket #12704 that also uses these setup. The problem I have described here sounds similar to another ticket (#7743).

comment:2 Changed 8 years ago by Jared Jurkiewicz

Owner: changed from Jared Jurkiewicz to Kris Zyp

comment:3 Changed 8 years ago by Kitson Kelly

I am having a similar issue in that when I do a filter or sort on the DataGrid?, it seems to cause the JsonRestStore? to only pull back the first "page" of items requested on the filter and incorrectly leverage it's cache for the remaining pages.

For example, I start off with the grid without any filter or sorting. I page through all my data, and I see 7 XHR requests to fetch the data in 25 ranges. This data is returned and displayed appropriately. With the last request returning:

Content-Range: items 150-161/162

Then I put a filter on the DataGrid? like:

dijit.byId("myGrid").filter({process:"process_name"});

What I see is the first XHR request is proper: GET http::localhost/rest/items.php/?process=process_name

And that request properly returns the new range based on the filter:

Content-Range: items 0-24/70

But the DataGrid? displays the first 25 items properly, but it appears the JsonRestStore? assumes the next items in the cache are appropriate and never fetch the proper ones off the server again.

comment:4 Changed 7 years ago by Colin Snover

Priority: highblocker

Bulk update of open ticket priorities.

comment:5 Changed 6 years ago by dylan

Resolution: wontfix
Status: newclosed

dojo/data is deprecated. Closing this as wontfix.

Note: See TracTickets for help on using tickets.