Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,251
    Vote Rating
    73
    Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold

      0  

    Default [FIXED-1185] Adding phantom/dirty records to a store doesn't make them modified

    [FIXED-1185] Adding phantom/dirty records to a store doesn't make them modified


    From this post:
    Adding a phantom or dirty record to a store doesn't automatically add it to the internal modified array, which also means they won't get saved when calling save().

    I suggest changing:
    Code:
    Ext.override(Ext.data.Store, {
        add : function(records){
            records = [].concat(records);
            if(records.length < 1){
                return;
            }
            var modified = [];
            for(var i = 0, len = records.length; i < len; i++){
                records[i].join(this);
                if (records[i].dirty || records[i].phantom) {
                    modified.push(records[i]);
                }
            }
            var index = this.data.length;
            this.data.addAll(records);
            if(this.snapshot){
                this.snapshot.addAll(records);
            }
            this.modified.push.apply(this.modified, modified);
            this.fireEvent('add', this, records, index);
        },
        insert : function(index, records){
            records = [].concat(records);
            var modified = [];
            for(var i = 0, len = records.length; i < len; i++){
                this.data.insert(index, records[i]);
                records[i].join(this);
                if (records[i].dirty || records[i].phantom) {
                    modified.push(records[i]);
                }
            }
            if(this.snapshot){
                this.snapshot.addAll(records);
            }
            this.modified.push.apply(this.modified, modified);
            this.fireEvent('add', this, records, index);
        }
    });

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

      0  

    Default


    Nice, though I went for this (and a similar change for insert):

    Code:
    add : function(records) {
        var i, record, index;
        
        records = [].concat(records);
        if (records.length < 1) {
            return;
        }
        
        for (i = 0, len = records.length; i < len; i++) {
            record = records[i];
            
            record.join(this);
            
            if (record.dirty || record.phantom) {
                this.modified.push(record);
            }
        }
        
        index = this.data.length;
        this.data.addAll(records);
        
        if (this.snapshot) {
            this.snapshot.addAll(records);
        }
        
        this.fireEvent('add', this, records, index);
    },
    The main difference is that I'm just pushing to this.modified inside the loop - was there a reason you chose not to?
    Ext JS Senior Software Architect
    Personal Blog: http://edspencer.net
    Twitter: http://twitter.com/edspencer
    Github: http://github.com/edspencer

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

      0  

    Default


    The change is now 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. How to Add & Retrieve Phantom Records from a JSON Store?
    By thedott in forum Ext 3.x: Help & Discussion
    Replies: 3
    Last Post: 6 Aug 2010, 6:40 AM
  2. Store.rejectChanges() + phantom records
    By Jonny5 in forum Ext 3.x: Help & Discussion
    Replies: 3
    Last Post: 21 Jun 2010, 9:49 AM
  3. [CLOSED] TreeStore doesn't keep track of modified records
    By ionut.rachita in forum Ext GWT: Bugs (2.x)
    Replies: 1
    Last Post: 1 Sep 2009, 12:12 PM
  4. Why deleted records don't go into Store.Modified[]?
    By velislav in forum Ext 2.x: Help & Discussion
    Replies: 8
    Last Post: 17 May 2009, 4:12 AM
  5. Replies: 1
    Last Post: 29 Jun 2007, 12:40 AM

Thread Participants: 1

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar