1. #1
    Sencha User
    Join Date
    Jan 2012
    Location
    Pune
    Posts
    71
    Vote Rating
    0
    kislay.kishore is on a distinguished road

      0  

    Question Problem while creating a store (with json)

    Problem while creating a store (with json)


    I am trying to generate a store for a line chart, store field contains a field with a point (.) in between. Something like abc-2.3-xyz.

    FYI, I am using extJs 4.x.


    I am getting below error while creating store:

    Code:
    missing ; before statement
    return Function.prototype.constructor.apply(Function.prototype, args);
    The error comes from ext-all-debug.js (line 397).

    Code:
    functionFactory: function() {
    390 var args = Array.prototype.slice.call(arguments);
    391
    392 if (args.length > 0) {
    393 args[args.length - 1] = 'var Ext=window.' + this.getUniqueGlobalNamespace() + ';' +
    394 args[args.length - 1];
    395 }
    396
    397 return Function.prototype.constructor.apply(Function.prototype, args);

    I tried to specify the type for creating the inline model as well, like below:
    PHP Code:
    var myStoreExt.create('Ext.data.JsonStore', {
        
    fields: [
      {
    name'month'type:'string'},
      {
    name'2671.1-Raised'type:'int'},
      {
    name'Defects Fixed'type:'int' }
      
      ],
        
    data : [
      {
       
    "month""Jan",
       
    "2671.1- Raised"10,
       
    "Defects Fixed"8
      
    },
      {
       
    "month""Feb",
       
    "2671.1- Raised"14,
       
    "Defects Fixed"10
      
    },
      {
       
    "month""Mar",
       
    "2671.1- Raised"20,
       
    "Defects Fixed"17
      
    }
     
      }); 
    But, again got the below error. I wonder if I have any way out here as the below error shows that ii is using obj. , and probably that why another . (dot) after it, is creating the problem. Can anyone suggest what to do to resolve this?
    Code:
    missing ; before statement
    var Ext=window.ExtBox1;return obj.2671.1-Raised

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,330
    Vote Rating
    847
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    I wouldn't use periods, you can change the field name and use mapping.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    Jan 2012
    Location
    Pune
    Posts
    71
    Vote Rating
    0
    kislay.kishore is on a distinguished road

      0  

    Default


    Hmmm....thats the only workaround I can think of this moment. But, is there really no way out??

  4. #4
    Sencha User
    Join Date
    Jan 2012
    Posts
    23
    Vote Rating
    0
    sbodanapu is on a distinguished road

      0  

    Default


    Quote Originally Posted by mitchellsimoens View Post
    I wouldn't use periods, you can change the field name and use mapping.

    I have been trying to render data on a tree grid panel . I am getting the same error

    Code:
    Type Error : c is undefined
                     
                return Function.prototype.constructor.apply(Function.prototype, args);                  ext-all-dev.js (line no 711)

    Here is the code which i am working on..


    Code:
    Ext.onReady(function() {
    
    Ext.define('Book', { 
       extend: 'Ext.data.Model',
        fields: [  
           {name: 'task',     type: 'string'},
           {name: 'duration',     type: 'int'},
           {name: 'user',     type: 'string'}
        ]
    });
    
    var store = Ext.create('Ext.data.TreeStore', {
      model: 'Book',
      autoLoad:true,
      data: {
              task:'Project: Shopping',
            duration:13,
            user:'Tommy Maintz',
            iconCls:'task-folder',
            expanded: true,
            children:[{
                task:'Housewares',
                duration:125,
                user:'Tommy Maintz',
                iconCls:'task-folder',
                children:[{
                    task:'Kitchen supplies',
                    duration:25,
                    user:'Tommy Maintz',
                    leaf:true,
                    iconCls:'task'
                },{
                    task:'Groceries',
                    duration:4,
                    user:'Tommy Maintz',
                    leaf:true,
                    iconCls:'task'
                },{
                    task:'Cleaning supplies',
                    duration:4,
                    user:'Tommy Maintz',
                    leaf:true,
                    iconCls:'task'
                },{
                    task: 'Office supplies',
                    duration: 2,
                    user: 'Tommy Maintz',
                    leaf: true,
                    iconCls: 'task'
                }]
            }]
        }
    
    });
    
    
    Ext.create('Ext.ux.tree.Panel', {title: 'Books',
         width: 500, height: 300,
         renderTo: Ext.getBody(),
         collapsible: true,
         useArrows: true,
         rootVisible: true,
         store: store,
         multiSelect: true,
         singleExpand: true,
         columns: [ 
          { 
             xtype: 'treecolumn',
              text: 'Task',
              flex: 2,
              sortable: true,
              dataIndex: 'book'
           },
           {
              text: 'Duration',
              flex: 1,
              dataIndex: 'duration',
              sortable: true
            },
    ,
           {
              text: 'user',
              flex: 1,
              dataIndex: 'user',
              sortable: true
            }        
         ]
    });
    
    
    
    
    
    });

    Please help me out..This is really bothering me a lot...

Thread Participants: 2