#14695 closed defect (fixed)
Observable does not place objects in position in the result set.
Reported by: | OwainD | Owned by: | Kris Zyp |
---|---|---|---|
Priority: | undecided | Milestone: | 1.7 |
Component: | Data | Version: | 1.6.1 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description
Currently when the observable processes a new object that either inserts or changes possition the object is either replaced in its old position or added to the end of the array. It sorts (a copy) of the array, and discovers where it should go and returns the index of where it should be but never puts it their.
if(changed && // if a matches function exists, use that (probably more efficient) (queryExecutor.matches ? queryExecutor.matches(changed) : queryExecutor([changed]).length)){ if(removedFrom > -1){ // put back in the original slot so it doesn't move unless it needs to (relying on a stable sort below) resultsArray.splice(removedFrom, 0, changed); }else{ resultsArray.push(changed); } //FIX: insert code here to place in the correct position. insertedInto = dojo.indexOf(queryExecutor(resultsArray), changed); if((options.start && insertedInto == 0) || (!atEnd && insertedInto == resultsArray.length -1)){ // if it is at the end of the page, assume it goes into the prev or next page insertedInto = -1; } }
The fix I am using myself inserts the following code at the indicated location:
// Now actually put that record in the right place!!! var currentlyAt = resultsArray.indexOf(changed); if (currentlyAt!=insertedInto){ var delta = currentlyAt>insertedInto?1:0; resultsArray.splice(insertedInto,0,changed); resultsArray.splice(currentlyAt+delta,1); }
I have looked through issues but have not found it recorded even uin newer versions of dojo.
Change History (5)
comment:1 Changed 8 years ago by
comment:2 Changed 8 years ago by
Component: | General → Data |
---|---|
Owner: | set to Kris Zyp |
comment:3 Changed 8 years ago by
Isn't this fixed in 1.7 (at least 1.7.2)? Or does this problem still persist?
comment:4 Changed 7 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:5 Changed 7 years ago by
Milestone: | tbd → 1.7 |
---|
Note: See
TracTickets for help on using
tickets.
That FIX: ... line should be one line down.
O