Results 1 to 2 of 2

Thread: How do you reload a tree (modern Ext.grid.Tree) using changing parameters.

  1. #1
    Sencha Premium User
    Join Date
    Sep 2016
    Posts
    6

    Default How do you reload a tree (modern Ext.grid.Tree) using changing parameters.

    How do you load a `Ext.grid.Tree`'s store without user the store's autoload config?


    I have a tree grid where the tree is loaded using a parameter from the router. E.g. `foo/settings/123` and I want to load the tree store where a regular store would `store.load({params:{id:123}})` But the TreeStore says the it's load method should not normally be called by developers.
    If I hard code the URL and use `{autoLoad:true}`, the TreeGrid loads correctly, but If I use `{autoLoad:false}`, and try to load the `tree` in response to the router's handler method, using `myTree.store.load({params:{id:123}}), I see the request and appropriate response, but the tree is not populated. What's the 'right' way to do this?

  2. #2
    Sencha Premium User
    Join Date
    Sep 2016
    Posts
    6

    Default

    Ended up doing this:

    Code:
            loadTree : function(tree, url, params) {
                tree.mask({
                    xtype: 'loadmask',
                    message: 'Loading Data..',
                    indicator: true
                });
                Ext.Ajax.request({
                    url : url,
                    method:'GET',
                    params : params,
                    success: function (response, opts) {
                        var obj = Ext.decode(response.responseText);
                        tree.setRootNode(obj);
                        tree.setMasked(false);
                    },
                    failure: function (response, opts) {
                        var obj = Ext.decode(response.responseText);
                        var msg = 'Failed to load tree with status: ' + response.status;
                        Ext.Msg.alert('Failure', msg);
                    }
                });
            },

Similar Threads

  1. Replies: 1
    Last Post: 18 Apr 2017, 1:36 PM
  2. Replies: 2
    Last Post: 26 Nov 2012, 5:43 AM
  3. Replies: 10
    Last Post: 19 Mar 2012, 3:19 PM
  4. 4.0.7 - tree store with direct proxy does not reload tree nodes
    By ExtJSNinjas in forum Sencha Ext JS Q&A
    Replies: 3
    Last Post: 24 Oct 2011, 1:16 PM
  5. Replies: 5
    Last Post: 26 May 2010, 1:03 AM

Tags for this Thread

Posting Permissions

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