-
6 Aug 2010 4:50 AM #1
[FIXED-1184] Store.insert() bug - reverse order
[FIXED-1184] Store.insert() bug - reverse order
Hi,
I have noticed an issue in the store insert() method. Here is the code.
What I get is that I insert an array of records at a certain index, and after insertion, they are in the reverse order. The reason is clear, as in the method above records[i] is inserted always at the "index" index, while the insertion index should increment by 1 at every iteration.Code:insert : function(index, records){ records = [].concat(records); for(var i = 0, len = records.length; i < len; i++){ this.data.insert(index, records[i]); records[i].join(this); } if(this.snapshot){ this.snapshot.addAll(records); } this.fireEvent('add', this, records, index); },
So if I have records [r1,r2,r3] and insert them in an empty store, at index 0, I get the records in the store in the following order: [r3,r2,r1], which is annoying.I blog about JavaScript and Ext on http://jslog.com. Contact me for ExtJs support. Follow me @extjslog.
-
6 Aug 2010 4:57 AM #2
Well, after a search, I have found the same bug already reported at http://www.sencha.com/forum/showthre...-reverse-order. Hope it will be fixed in the future version of Ext, with the fix that Animal pointed a=out.
I blog about JavaScript and Ext on http://jslog.com. Contact me for ExtJs support. Follow me @extjslog.
-
6 Aug 2010 10:20 AM #3Sencha - Sencha Touch Dev Team
- Join Date
- Mar 2007
- Location
- Redwood City, California
- Posts
- 3,659
- Vote Rating
- 14
Thank you for the report. If the post isn't in the bug forum with a number assigned to it in the title, there's a good chance we don't know about it.
-
6 Aug 2010 10:35 AM #4Sencha - Community Support Team
- Join Date
- Jan 2009
- Location
- Palo Alto, California
- Posts
- 1,941
- Vote Rating
- 6
Thanks, this has been fixed in svn and will appear in 3.3 beta 2
Ext JS Senior Software Architect
Personal Blog: http://edspencer.net
Twitter: http://twitter.com/edspencer
Github: http://github.com/edspencer
Thank you for reporting this bug. We will make it our priority to review this report.
Similar Threads
-
[FIXED] Grid dnd display bug when insert mode is on.
By fr@hd3d.fr in forum Ext GWT: Bugs (2.x)Replies: 2Last Post: 19 Nov 2009, 1:47 AM -
Datastore - Insert works in reverse order
By grubi in forum Ext 3.x: Help & DiscussionReplies: 3Last Post: 2 Nov 2009, 12:50 PM -
Bug in Store.insert/add with filter?
By balajiratnam in forum Ext 1.x: BugsReplies: 2Last Post: 10 Sep 2007, 9:12 PM


Reply With Quote