Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#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:


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);
   //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;

I have looked through issues but have not found it recorded even uin newer versions of dojo.

Change History (5)

comment:1 Changed 10 years ago by OwainD

That FIX: ... line should be one line down.


comment:2 Changed 10 years ago by bill

Component: GeneralData
Owner: set to Kris Zyp

comment:3 Changed 10 years ago by Kris Zyp

Isn't this fixed in 1.7 (at least 1.7.2)? Or does this problem still persist?

comment:4 Changed 10 years ago by Kris Zyp

Resolution: fixed
Status: newclosed

comment:5 Changed 10 years ago by bill

Milestone: tbd1.7
Note: See TracTickets for help on using tickets.