Opened 12 years ago

Closed 12 years ago

Last modified 11 years ago

#5275 closed defect (fixed)

Grid: ItemFileWriteStore, after sorting, edit data in table changes incorrect table row data

Reported by: guest Owned by: sorvell
Priority: high Milestone:
Component: DojoX Grid Version: 1.0
Keywords: grid itemfilewritestore sort Cc: frank.fortson@…
Blocked By: Blocking:

Description

In a Grid, using ItemFileReadStore?, after sorting, if you use an editor in a cell to change the value of the cell's "data", the grid.model.data[i]."field" is changed appropriately, where i = the table row index and the grid.model.data index. No change is made to grid.model.store, appropriately.

However, in a Grid, using ItemFileWriteStore?, after sorting, if you use an editor in a cell to change the value of the cell's "data", the grid.model.data[i]."field" is changed correctly, but also an additional grid.model.data[j]."field" may be changed "incorrectly", while the grid.model.store 'i'th or 'j'th value is changed, where i = the grid.model.store index. The grid.model.store index is not correct for the grid.model.data when the table has been sorted, nor is the grid.model.data index correct for the grid.model.store, when the table has been sorted.

The grid.model.store data is always stored in the same order as when it was initially loaded. Its indices are never re-ordered.

The grid.model.data data is "re-indexed" (to match the visible row order) whenever the grid is sorted. Its indices can never be assumed to correspond to the grid.model.store indices.

So, it is incorrect to assume, in the ItemFileWriteStore? case, that a change in the grid.model.data (visible row data)'s index will point to the same row in grid.model.store. It may not.

See attached file, adapted from the dojox/grid/tests/test_tundra_edit.html file.

Using the Read store in the left Grid and clicking on a checkbox, only that checkbox is "checked", both before sorting and after sorting (by clicking on the "i" column header).

Using the Write store in the right Grid and clicking on a checkbox correctly checks a single checkbox, before sorting, but after sorting (by clicking on the "i" column header), clicking the "6" or "1" checkbox will check BOTH associated checkboxes. The grid.model.data indices 1 and 6 get set true. The grid.model.store index 1 or 6 is set true and the other is set false.

I believe it is just a problem of not translating the clicked grid.model.data index into the correct grid.model.store index.

Attachments (1)

test_grid_EditingReadWrite.html (4.8 KB) - added by guest 12 years ago.
ItemFileWriteStore?, incorrect grid.model.data changes after sorting and editing.

Download all attachments as: .zip

Change History (7)

Changed 12 years ago by guest

ItemFileWriteStore?, incorrect grid.model.data changes after sorting and editing.

comment:1 Changed 12 years ago by guest

frankf: I believe the problem is in the model change -> store update -> model update chain in dojox/grid/_data/model.js.

comment:2 Changed 12 years ago by Adam Peller

Milestone: 1.0.21.0.3

comment:3 in reply to:  2 Changed 12 years ago by guest

Original Poster (frankf):

Please close this ticket as Fixed, by Ticket 5555.

comment:4 Changed 12 years ago by dante

Milestone: 1.0.31.1
Resolution: fixed
Status: newclosed

comment:5 Changed 12 years ago by dante

Milestone: 1.11.0.3

this made it into branch, too.

comment:6 Changed 11 years ago by (none)

Milestone: 1.0.3

Milestone 1.0.3 deleted

Note: See TracTickets for help on using tickets.