Results 1 to 6 of 6

Thread: autoLoad:true is ignored for treeStore?

  1. #1
    Sencha User
    Join Date
    Apr 2008
    Posts
    19
    Vote Rating
    0
      0  

    Default autoLoad:true is ignored for treeStore?

    I have a JSONP treeStore:
    Code:
    Ext.define('AM.store.JSONP',{
        extend:'Ext.data.TreeStore',
        model: 'AM.model.JSONP',
        autoLoad:true,
        proxy:{
            actionMethods:{'read':'POST','write':'POST'},
            reader:{
                    root:'Nodes',
                    type:'json'
            },
            type:'ajax',
            url:'http://XXX'
        },
        root:"Nodes"
    });
    But for some reason autoLoad:true is not working and after the render there is only an empty treegrid panel.
    How should i load a store in a controller on render event according to the MVC model?

  2. #2
    Ext JS Premium Member dogomatic's Avatar
    Join Date
    Aug 2007
    Location
    Canada
    Posts
    111
    Vote Rating
    2
      0  

    Default

    Yes, it looks like autoLoad is ignored in TreeStore.

    But it should load as soon as you use it in a TreePanel. Make sure it's included in your controller's stores.

  3. #3
    Sencha User
    Join Date
    Apr 2008
    Posts
    19
    Vote Rating
    0
      0  

    Default

    Quote Originally Posted by dogomatic View Post
    But it should load as soon as you use it in a TreePanel. Make sure it's included in your controller's stores.
    In my view i have it defined in store parameter:
    Code:
    Ext.define('ADM.view.XXX',{
        extend:'Ext.tree.Panel',
        alias:'widget.XXX',
        title:'Editor',
        store:'JSONP',
    but it doesn't work... to load data to JSONP store i have to manually fire load event in the controller:
    Code:
        onLaunch:function(){
            this.getJSONPStore().load();
        }

  4. #4
    Ext JS Premium Member dogomatic's Avatar
    Join Date
    Aug 2007
    Location
    Canada
    Posts
    111
    Vote Rating
    2
      0  

    Default

    Wait, so you're defining a TreePanel subclass, but are you actually using it anywhere?

    Look at the TreePanel example. It doesn't call load anywhere:
    http://dev.sencha.com/deploy/ext-4.0...ree/reorder.js

  5. #5
    Sencha User
    Join Date
    Apr 2008
    Posts
    19
    Vote Rating
    0
      0  

    Default

    Yup, i'm using it in my app file... If i wouldn't use it, this.getJSONPStore().load() haven't help me
    The point is: if i use an ajax store - i got my data rendered automatically on page load. Even without setting autoLoad:true anywhere in the store. With JSONP store(the only changes are type: 'ajax' -> 'jsonp' and url) i have to use load() method in onLaunch event otherwise - empty treepanel and in firebug i see no requests whatsoever.

  6. #6
    Sencha User
    Join Date
    Apr 2008
    Posts
    19
    Vote Rating
    0
      0  

    Default

    I've found that JSONP store starts to automatically load the data upon a page load if i set rootVisible:false in treePanel view... pretty wired but it works for me, so no more this.getJSONPStore().load() in onLaunch event...

Posting Permissions

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