Results 1 to 2 of 2

Thread: store.insert() fiendishly meddling with data

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Sencha User cnesbit's Avatar
    Join Date
    Feb 2009
    Posts
    55
    Vote Rating
    0
      0  

    Exclamation store.insert() fiendishly meddling with data

    I've got a GridPanel. It works great, and I can add a record to the grid/store aspects of the object.

    But here's my problem, and I'm convinced it has nothing to do with my grid and everything to do with my store (which happens to be the normal Ext.data.Store). I've got a quantity field (int data type) and a cost field (float data type) among others. When I insert a new record with quantity=1 and cost=4.75 weird things happen.

    Code:
    //this = the grid
    //newrecord = the record I'm inserting
     
    var destFields = this.store.fields.items;
    var destData = new Array();
    for(var i=0, len=destFields.length; i<len; i++) {
       destData[destFields[i].name] = newrecord.data[destFields[i].name];
    }
    var rec = new createdRecord(destData);
    
    console.log('store.insert [console a]: ',destData['cost'], rec.data.cost); //echos: "store.insert [console a]: 4.75 4.75
    this.store.insert(insertIndex,rec);
    console.log('store.insert [console b]: ',destData['cost'],  rec.data.cost);//echos: "store.insert  [console b]: 9.5 9.5
    console.log('store.data: ',this.store.data[8].cost);//echos: "store.data: 9.5
    anybody have any idea why calling this.store.insert() would change the value of rec.data.cost but also destData['cost'] and more importantly the data being placed into the store? This is a really odd bug.

    - cnesbit

  2. #2
    Sencha User cnesbit's Avatar
    Join Date
    Feb 2009
    Posts
    55
    Vote Rating
    0
      0  

    Default

    bump... any ideas anyone?

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •