Results 1 to 7 of 7

Thread: How to stop TreeStore autoload?

  1. #1
    Ext JS Premium Member
    Join Date
    Jun 2011
    Posts
    33
    Answers
    1
    Vote Rating
    1
      0  

    Default 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 Premium User mankz's Avatar
    Join Date
    Nov 2007
    Location
    Stockholm, Sweden
    Posts
    3,046
    Answers
    33
    Vote Rating
    183
      0  

    Default

    Code:
    root: {
          expanded: false
    }

  4. #3
    Ext JS Premium Member
    Join Date
    Jun 2011
    Posts
    33
    Answers
    1
    Vote Rating
    1
      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
      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,790
    Answers
    583
    Vote Rating
    390
      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
      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
      0  

    Default

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

    Thanks

Posting Permissions

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