Opened 9 years ago
Closed 8 years ago
#12670 closed defect (fixed)
Second Argument of observe listener function is wrong when items are sorted
Reported by: | ctulek | Owned by: | Kris Zyp |
---|---|---|---|
Priority: | high | Milestone: | 1.7 |
Component: | Data | Version: | 1.6.0 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description (last modified by )
Browser Type: Any
Browser Version: Any
OS: Any
Try the following code:
var memory = new dojo.store.Memory(); var observer = new dojo.store.Observable(memory); var query = observer.query(null, {sort: [{attribute: "order"}]}); query.observe(function(item, removedFrom, insertedInto) { console.log(arguments); if(removedFrom > -1){ // existing object removed } if(insertedInto > -1){ // new or updated object inserted } }, true); memory.put({id: 1, order: 1, text: "Test 1"}); memory.put({id: 2, order: 2, text: "Test 2"}); memory.put({id: 3, order: 4, text: "Test 3"}); memory.put({id: 4, order: 3, text: "Test 4"}); memory.put({id: 5, order: 5, text: "Test 5"}); var item = memory.get(3); item.order = 5; memory.put(item);
Output:
[ Object , -1, 0] [ Object , -1, 1] [ Object , -1, 2] [ Object , -1, 2] [ Object , -1, 4] [ Object , 2, 3] // This is wrong
Expected Output:
[ Object , -1, 0] [ Object , -1, 1] [ Object , -1, 2] [ Object , -1, 2] [ Object , -1, 4] [ Object , 4, 3]
Change History (5)
comment:1 Changed 9 years ago by
Component: | Query → Data |
---|---|
Owner: | changed from alex to Kris Zyp |
comment:3 Changed 8 years ago by
I'm not sure what your comment means:
It looks like is not yet merged with 1.7 trunk
Trunk and 1.7 are two different things, and regardless a change from four months ago is surely in the 1.7.0 tag, the 1.7 branch, and trunk.
comment:4 Changed 8 years ago by
Oh sorry, i meant branch. And yes the changeset is included, it just changed even more and i could not find it.
Please excuse the confusion caused.
comment:5 Changed 8 years ago by
Description: | modified (diff) |
---|---|
Milestone: | tbd → 1.7 |
Resolution: | → fixed |
Status: | new → closed |
No worries, OK I am marking this as fixed in 1.7.
Note: See
TracTickets for help on using
tickets.
For the record:
if anyone stumbles upon this bug. It is fixed by this change http://bugs.dojotoolkit.org/changeset/26097/dojo
It looks like is not yet merged with 1.7 trunk