1. #1
    Ext JS Premium Member
    Join Date
    Jun 2011
    Posts
    33
    Answers
    1
    Vote Rating
    1
    psewt is on a distinguished road

      0  

    Default Answered: How to stop TreeStore autoload?

    Answered: How to stop TreeStore autoload?


    I have a tree with a store Ext.data.TreeStore.
    Whenever the store is created the data is autoloaded. The parameter autoLoad: false.

    Ext.define('MyStore', {
    extend: 'Ext.data.TreeStore',
    fields: ['id', 'text'],
    autoLoad: false,
    proxy: {
    type: 'ajax',
    url: 'some.url'
    },
    root: {
    expanded: true
    }
    });

    I need to pass some parameters into url prior loading and I know the parameters only after everything is rendered, so how can I stop the autoloading?
    -->

  2. Quote Originally Posted by lucasguaru View Post
    Try it with children and autoLoad : false
    Code:
    root: {
        children : []
    }
    This one works, thanks.

  3. #2
    Sencha - Community Support Team mankz's Avatar
    Join Date
    Nov 2007
    Location
    Stockholm, Sweden
    Posts
    2,753
    Answers
    33
    Vote Rating
    106
    mankz is a name known to all mankz is a name known to all mankz is a name known to all mankz is a name known to all mankz is a name known to all mankz is a name known to all

      0  

    Default


    Code:
    root: {
          expanded: false
    }
    -->

  4. #3
    Ext JS Premium Member
    Join Date
    Jun 2011
    Posts
    33
    Answers
    1
    Vote Rating
    1
    psewt is on a distinguished road

      0  

    Default


    Quote Originally Posted by mankz View Post
    Code:
    root: {
          expanded: false
    }
    This works only if for 'Ext.tree.Panel' 'rootVisible: false'.
    The problem is that I need it with invisible root, but when it's set to invisible then the root automatically expands and than it loads. Seems to me like bug that we cannot set the rootVisible without firing the load.
    Any other solution?
    -->

  5. #4
    Sencha User lucasguaru's Avatar
    Join Date
    May 2011
    Location
    Guaruj√°, Brazil
    Posts
    77
    Answers
    9
    Vote Rating
    2
    lucasguaru is on a distinguished road

      0  

    Talking


    Try it with children and autoLoad : false
    Code:
    root: {
        children : []
    }
    -->

  6. #5
    Sencha Premium Member skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,596
    Answers
    542
    Vote Rating
    324
    skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future

      0  

    Default


    What about just not configuring a root node? When you're ready for the (invisible) root node to load just call setRootNode() with the relevant details:

    http://docs.sencha.com/ext-js/4-0/#!...od-setRootNode
    -->

  7. #6
    Ext JS Premium Member
    Join Date
    Jun 2011
    Posts
    33
    Answers
    1
    Vote Rating
    1
    psewt is on a distinguished road

      0  

    Default


    Quote Originally Posted by lucasguaru View Post
    Try it with children and autoLoad : false
    Code:
    root: {
        children : []
    }
    This one works, thanks.
    -->

  8. #7
    Sencha User lucasguaru's Avatar
    Join Date
    May 2011
    Location
    Guaruj√°, Brazil
    Posts
    77
    Answers
    9
    Vote Rating
    2
    lucasguaru is on a distinguished road

      0  

    Default


    Can you mark the answer as "Best Answer" to close the thread?

    Thanks
    -->