Opened 13 years ago
Closed 13 years ago
#7145 closed defect (fixed)
dojo.data.ItemFileWriteStore: possible problem when calling store.revert()
Reported by: | Nathan Toone | Owned by: | Jared Jurkiewicz |
---|---|---|---|
Priority: | high | Milestone: | 1.2 |
Component: | Data | Version: | 1.1.1 |
Keywords: | Cc: | [email protected]… | |
Blocked By: | Blocking: |
Description
This is from rgl on IRC:
The attached file contains an example (my first attempt at using it *G*) using DataGrid? and ItemFileWriteStore?; After you run the next steps, it ends with something I wasn't expecting:
- Click Append Row
- Select the appended row on the grid
- Click Delete Selected Rows
- Click Revert
- For some reason the grid is not empty
Attachments (3)
Change History (10)
Changed 13 years ago by
Attachment: | datagrid.html added |
---|
comment:1 Changed 13 years ago by
Cc: | [email protected]… added |
---|
comment:2 Changed 13 years ago by
I just bumped into this yesterday. The problem is that the revert actions in ItemFileWriteStore.revert()
are in reverse order.
Changes should be reverted in the order: deleted, modified, new. (Currently they're reverted in the order: new, modified, deleted. So a new item that's later either modified or deleted will be reverted by the "new" block, then re-inserted by the modified/delete revert.)
Swapping the new and delete blocks in revert()
should fix the problem.
comment:3 Changed 13 years ago by
Reversing the order definitely fixes it. Running tests now on IE, Firefox, and Safari to verify it doesn't break anything. Will submit patches to this tracker, then commit the change.
comment:5 Changed 13 years ago by
Milestone: | tbd → 1.2 |
---|
Changed 13 years ago by
Attachment: | dojox.data_AndOrWriteStore_20080716.patch added |
---|
Changed 13 years ago by
Attachment: | dojo.data_ItemFileWriteStore_20080716.patch added |
---|
comment:7 Changed 13 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
I have confirmed that this also occurs if you have an IFWS and call: store.newItem(); store.deleteItem(); store.revert();
It would be expected (since no save has occured) that the store should be empty - however, deleting a newly-created item and then reverting retains the newly-created item.