1. #1
    Ext JS Premium Member
    Join Date
    Sep 2010
    Location
    Omaha
    Posts
    10
    Vote Rating
    0
    icode is on a distinguished road

      0  

    Post [Ext: 4.1 RC1] Problem with store

    [Ext: 4.1 RC1] Problem with store


    I have just recently started our upgrade to 4.1RC1. Right off the bat I am running into this issue. On 4.0.7 our stores contained values for fields that were not explicitly defined in the model and we relied on that heavily. Now I cannot access a field if I didn't explicitly define it before hand on my model. Here is a simple example.
    Data:
    Code:
    var data = {
          data1: 4,
          data2: 1,
          data1_subset: 3,
          data2_subset: 3
    }
    Store:
    Code:
    aStore = Ext.create('Ext.data.JsonStore', {
          fields: ["data1, data2"],
         data: data
    });

    Chart:

    Code:
    Ext.create('Ext.chart.Chart', {
    .
    .
    tips: {
        renderer: function(record, item) {
        //doesn't work on 4.1RC1
         var subset = record.data.data1_subset
        }
    }
    The store is used by grid and chart which doesn't care about "data1_subset", but in my chart's tooltip I need information on "data1_subset". Before I could access undefined fields on my tips' renderer function. Now it seems I do not have access to my data1_subset. Am I missing something? Is there a way to force my model/jsonStore to hold everything I assign in the "data" property?
    Last edited by icode; 3 Apr 2012 at 7:20 AM. Reason: ninja edit: fix code

  2. #2
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    16,663
    Vote Rating
    584
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    Try this:

    Code:
    Ext.onReady(function() {
        var data = [{
            data1: 4,
            data2: 1,
            data1_subset: 3,
            data2_subset: 3
        }];
        
        var s = Ext.create('Ext.data.Store', {
            fields: ["data1, data2"],
            data: data
        });
    
        console.log(s.first().raw);
    });
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

Thread Participants: 1