HZGN.COM
welcome to my space
X
Welcome to:hzgn.com
Search:  
NAVIGATION - HOME

[SOLVED] jsonStore onload problem? (autoLoad: true)

Published by: mike 2009-01-07

  • Martial Arts | Career Management | Home Business | Remodeling ::
    Ok we have had this problem for a little while and are looking for an answer. .. It just sounds too good to be true. I don't want to give my credit card
    http://mercialleasing.com/
    HOME
    /***************************************/
    //Import User Data - My sample file
    /***************************************/
    var userData = new Ext.data.JsonStore({
    url: 'userdata/user-j0001.json',
    root: 'userData',
    id: 'userId',
    autoLoad: true
    },[
    {name:'userId', type:'int'},
    {name:'userName', type:'string'},
    {name:'fullName', type:'string'}
    ]);
    /***************************************/
    /***************************************/
    userData.on('load', function() {console.log(userData.getById(1).userName);})

    I can see in firebug that user-j0001.json is being loaded.
    But my on load event is being ignored, anyone got any ideas with what I can try to find where the problem lies?

    Thanks


  • Thanks Condor, that fixed the problem.

    I thought I didn't need to include fields, because I had the array at the end which does the
    Ext.data.Record.create allowing me to set the mappings,... .. right:s?
    XXX Amateur Blog Verzeichnis::
    disableKeyFilter: inputs[j].getAttribute("disableKeyFilter") == "true", .. If I add the doctype the problem disappears but I can't do that.
    http://www.erotikweblogs.com/view.php?feed=1034&what=all
    HOME

    I was looking at the JsonReader api docs.

    I thought JsonStore had JsonReader integrated and there is no need to specify the reader param..


    Now I`m having problems with returning the json value of userName.

    This is a sample of the json file.
    {"userData":[{

    "userId":1,

    "userName":"j0001",

    "fullName":"John Doe"

    }

    ]}
    I`m using this:
    userData.getById(1).userName

    I have uploaded an example here: (http://www.bluestudios.co.uk/temp/testbed3.html)

    I see what I missed :)
    userData.getById(1).data.userName
    or
    userData.getById(1).get('userName')

    This works.
    Thanks for your help guys thought I was going crazy when the json file was being loaded but the events were being ignored.


  • This is silly I must be missing something so obvious.

    I have uploaded an example stripped down..
    http://www.bluestudios.co.uk/temp/testbed2.html

    I`m still not getting the console.log to output anything on the onload inline listener.. :(
    It should display: "load Worked!" withing firebug but I get nothing.. The JSON file does seem to download fine though..



    Grid Filter (Plugin) - Page 46 - Ext JS Forums::
    Make sure phpMode is true in the javascript filters definition: eg filters . how to solve this problem? thx Figure it out, onLoad() add this.value = [];
    http://www.yui-ext.com/forum/showthread.php?p=176352
    HOME






  • there is a problem with execution sequence:

    you're instantiating the store, telling it to auto load, then saying - after you load, fire this function.

    Well, the store loaded, then it learned that it needed to run that function after the next load.

    Remove autoLoad and execute load after setting up the listener.


  • Your parameters for JsonStore are wrong.

    Use:

    var userData = new Ext.data.JsonStore({
    url: 'userdata/user-j0001.json',
    root: 'userData',
    id: 'userId',
    listeners: {
    load: function(){
    console.log('load Worked!');
    }
    },
    autoLoad: true,
    fields: [
    {name:'userId', type:'int'},
    {name:'userName', type:'string'},
    {name:'fullName', type:'string'}
    ]
    });


  • Just to clarify, are you saying the onLoad function is never getting called? Verify by sticking an alert message in the function or setting a break point. There might be a problem with your json data resulting in the console.log message being blank.

    userData.on('load', function() {console.log(userData.getById(1).userName);})
    userData.load();

    This should work.


  • How about defining the listeners inline:
    /***************************************/
    //Import User Data - My sample file
    /***************************************/
    var userData = new Ext.data.JsonStore({
    url: 'userdata/user-j0001.json',
    root: 'userData',
    id: 'userId',
    listeners: { load: function(store) {console.log(store.getById(1).userName);} },
    autoLoad: true
    },[
    {name:'userId', type:'int'},
    {name:'userName', type:'string'},
    {name:'fullName', type:'string'}
    ]

    );
    /***************************************/
    /***************************************/


  • Thanks djliquidice, but I`m still not having much luck..
    I`m using ext2.01

    I`ve tried this.

    /***************************************/
    //Import User Data - My sample file
    /***************************************/
    var userData = new Ext.data.JsonStore({
    url: 'userdata/user-j0001.json',
    root: 'userData',
    id: 'userId',
    listeners: {
    load: function(){
    console.log('load Worked!');
    }
    },
    autoLoad: true
    },[
    {name:'userId', type:'int'},
    {name:'userName', type:'string'},
    {name:'fullName', type:'string'}
    ]);
    /***************************************/
    /***************************************/


    And This


    /***************************************/
    //Import User Data - My sample file
    /***************************************/
    var userData = new Ext.data.JsonStore({
    url: 'userdata/user-j0001.json',
    root: 'userData',
    id: 'userId'
    },[
    {name:'userId', type:'int'},
    {name:'userName', type:'string'},
    {name:'fullName', type:'string'}
    ]);
    /***************************************/
    /***************************************/
    userData.on('load', function() {console.log(userData.getById(1).userName);})
    userData.load();


    I can`t figure out what I`m doing wrong :s
    I don`t need to specify reader: because thats bundled in with json store.





  • Red Hat's Rough Recovery From CFO Exit
    Windows Live Finds a New, Pre-installed Home

  • firefox web browser download now and configure your privacy settings
  • free hardware and installation from directv
  • free computer training
  • finding affordable hard drives
  • find usefull information about digital signage
  • enjoy more of what you enjoy with high definition tv programming
  • for total control choose direct tv
  • express yourself to the max with hot myspace layouts
  • free online computer training
  • erasing your pc from past internet activities
  • free myspace backgrounds can do wonders
  • flourish of online businesses
  • for rv owners dish network now has mobile dish
  • everything there is to know about direct tv

  • free reverse phone look up
  • fine information about digital signage
  • employer sponsored online computer training
  • free firefox download get it now and secure your pc instantly
  • free satellite equipment and installation from directv
  • fierfox security tools of the best browser
  • finding the best computer processor for your needs
  • fear not high definition tv programming
  • free myspace layouts to perk up your life
  • evaluating a used computer
  • free installation and hd tv from directv
  • factors in cd duplication
  • essential wordpress 2 3 plugins
  • #If you have any other info about this subject , Please add it free.#
    Your name:
    E-mail:
    Telphone:

    Your comments:


    If you have any other info about [SOLVED] jsonStore onload problem? (autoLoad: true) , Please add it free.
     Homepage | Add to favorites | Contact us | Exchange links | LOGIN | Site map | 
    Copyright© 2008 hzgn.com        Site made:CFZ