Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Sencha User
    Join Date
    Oct 2009
    Location
    Romania
    Posts
    56
    Vote Rating
    0
    radubrehar is on a distinguished road

      0  

    Default [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.
    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);
        },
    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.

    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.

  2. #2
    Sencha User
    Join Date
    Oct 2009
    Location
    Romania
    Posts
    56
    Vote Rating
    0
    radubrehar is on a distinguished road

      0  

    Default


    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.

  3. #3
    Sencha User Jamie Avins's Avatar
    Join Date
    Mar 2007
    Location
    Redwood City, California
    Posts
    3,661
    Vote Rating
    20
    Jamie Avins is a jewel in the rough Jamie Avins is a jewel in the rough Jamie Avins is a jewel in the rough

      0  

    Default


    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.

  4. #4
    Sencha - Community Support Team edspencer's Avatar
    Join Date
    Jan 2009
    Location
    Palo Alto, California
    Posts
    1,939
    Vote Rating
    9
    edspencer is a jewel in the rough edspencer is a jewel in the rough edspencer is a jewel in the rough

      0  

    Default


    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

Similar Threads

  1. [FIXED] Grid dnd display bug when insert mode is on.
    By fr@hd3d.fr in forum Ext GWT: Bugs (2.x)
    Replies: 2
    Last Post: 19 Nov 2009, 1:47 AM
  2. Datastore - Insert works in reverse order
    By grubi in forum Ext 3.x: Help & Discussion
    Replies: 3
    Last Post: 2 Nov 2009, 12:50 PM
  3. Bug in Store.insert/add with filter?
    By balajiratnam in forum Ext 1.x: Bugs
    Replies: 2
    Last Post: 10 Sep 2007, 9:12 PM

Thread Participants: 2

Tags for this Thread