1. #1
    Sencha User
    Join Date
    Jan 2008
    Posts
    6
    Vote Rating
    0
    kjh is on a distinguished road

      0  

    Default Problems with a Store loading JSON Data

    Problems with a Store loading JSON Data


    Hello,

    sorry for that basic problem. But I'm very new to ExtJS. I've got a problem loading JSON Data provided by an php file into a store to display the data in a form.

    What I've done is this:

    Code:
    Ext.onReady(function () {
        
            store1 = new Ext.data.JsonStore({  
            url: 'data.php?data=1',  
            root: 'thedata',  
            fields: [{name:'data1',type:'float'}]
        });  
        
    store1.loadData();    
    
        
    });
    OK, this shows up an message in Firebug like this:

    Code:
    g is undefined
    (function(){var e=this,a=Object.protot...eate("Ext.XTemplate",j,g)}return j}});
    g is undifined. Oh yes, tells me nothing.

    My JSON looks like this:

    Code:
    {"thedata":{"data1":1.22}}
    Where did it go wrong?

    Thanks for any hint!

    KJH

  2. #2
    Ext JS Premium Member stevil's Avatar
    Join Date
    Nov 2007
    Location
    Denver, CO
    Posts
    1,045
    Vote Rating
    9
    stevil will become famous soon enough

      0  

    Default


    Your life will be easier if you (for now) use ext-all-debug.js - it's not minified, so "g" would actually be a meaningful reference.

    As for your store, can you try something like this?

    PHP Code:
    Ext.define('MyModel', {
        
    fields: [
            { 
    name'data1'type'float' }
        ]
    });

    var 
    store1Ext.create('Ext.data.Store', {
        
    model'MyModel'
        
    autoLoadtrue
        
    proxy: {
            
    type'ajax'
            
    url'data.php?data=1',
            , 
    reader: {
                
    type'json'
                
    root'thedata'
            
    }
        }
    }); 
    stevil

  3. #3
    Sencha User
    Join Date
    Apr 2010
    Location
    Berlin
    Posts
    19
    Vote Rating
    0
    vollchraZ is on a distinguished road

      0  

    Default


    You are using ExtJS 4? IMHO there is no JsonStore anymore.

  4. #4
    Ext JS Premium Member
    Join Date
    Dec 2010
    Location
    Hamburg, Germany
    Posts
    193
    Vote Rating
    7
    winkelmann will become famous soon enough

      0  

    Default


    The stores still exist in the sources (ExtJS package src/data/JsonStore.js). They're not in the docs though.

Similar Threads

  1. Problem while loading Json Store Data
    By irfaniqbal in forum Sencha Touch 1.x: Discussion
    Replies: 0
    Last Post: 13 Jan 2011, 4:15 AM
  2. Problem loading data into a Json store
    By r_honey in forum Ext 3.x: Help & Discussion
    Replies: 5
    Last Post: 15 Feb 2010, 8:21 AM
  3. JSON Store isn't loading JSON Data
    By WhirlingDerBing in forum Ext 3.x: Help & Discussion
    Replies: 3
    Last Post: 3 Nov 2009, 4:37 PM
  4. [SOLVED]Problems loading JSON store into Form
    By josh803316 in forum Ext 2.x: Help & Discussion
    Replies: 7
    Last Post: 13 Jun 2008, 4:44 PM
  5. Json data not loading in data store
    By Renuplex in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 27 Mar 2008, 6:21 AM

Thread Participants: 3