Ticket #5275 (closed defect: fixed)

Opened 12 months ago

Last modified 8 months ago

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

Reported by: guest Owned by: sorvell
Priority: normal Milestone:
Component: DojoX Grid Version: 1.0
Severity: normal Keywords: grid itemfilewritestore sort
Cc: frank.fortson@…

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

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

Change History

Changed 12 months ago by guest

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

  Changed 12 months ago by guest

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

follow-up: ↓ 3   Changed 12 months ago by peller

  • milestone changed from 1.0.2 to 1.0.3

in reply to: ↑ 2   Changed 10 months ago by guest

Original Poster (frankf):

Please close this ticket as Fixed, by Ticket 5555.

  Changed 10 months ago by dante

  • status changed from new to closed
  • resolution set to fixed
  • milestone changed from 1.0.3 to 1.1

  Changed 10 months ago by dante

  • milestone changed from 1.1 to 1.0.3

this made it into branch, too.

  Changed 8 months ago by anonymous

  • milestone deleted

Milestone 1.0.3 deleted

Note: See TracTickets for help on using tickets.