Results 1 to 3 of 3

Thread: Working with TreePanel and remote data.

  1. #1
    Sencha Premium User
    Join Date
    Feb 2016
    Posts
    63

    Question Answered: Working with TreePanel and remote data.

    Hi,

    I want to load my treepanel with remote data.
    I tried by using ajax proxy but couldn't achieve the result, is there any way to achieve this?
    Also the reader's getRoot fn was being called with a dummy root while the store is created.
    And the ajax call for data is never made!

    My config:
    Code:
    Ext.create(Ext.window.Window, {
        autoShow: true,
        height: 600,
        width: 900,
        items: [
            {
                xtype: 'treepanel',
                store: {
                    type: 'tree',
                    autoLoad: true,
                    proxy: {
                        type: 'ajax',
                        actionMethods: {
                            read: 'POST',
                            update: 'POST'
                        },
                        url: 'getTreeData',
                        reader: {
                            type: 'json',
                            rootProperty: 'root',
                            successProperty: 'status'
                        }
                    }
                }
            }
        ]
    });
    Thanks,
    Amit

  2. Hi Amit.

    Take a look to the root property of treestore, it must be right this:

    Code:
    store: {
        type: 'tree',
        autoLoad: true,
        proxy: {
           type: 'ajax',
           actionMethods: {
                read: 'POST',
                update: 'POST'
            },
            url: 'getTreeData',
            reader: {
                type: 'json',
                rootProperty: 'root',
                successProperty: 'status'
            }
        },
    //This is what you need
        root:{
          expanded: true
        }
    }
    However, I have had some problems loading the treestore into a treepanel, I have solved it by updating the proxy and the root property after displaying the treepanel

    Regards
    - Daniel

  3. #2
    Sencha User
    Join Date
    Dec 2016
    Location
    Reynosa, Tamaulipas
    Posts
    3
    Answers
    1

    Default

    Hi Amit.

    Take a look to the root property of treestore, it must be right this:

    Code:
    store: {
        type: 'tree',
        autoLoad: true,
        proxy: {
           type: 'ajax',
           actionMethods: {
                read: 'POST',
                update: 'POST'
            },
            url: 'getTreeData',
            reader: {
                type: 'json',
                rootProperty: 'root',
                successProperty: 'status'
            }
        },
    //This is what you need
        root:{
          expanded: true
        }
    }
    However, I have had some problems loading the treestore into a treepanel, I have solved it by updating the proxy and the root property after displaying the treepanel

    Regards
    - Daniel

  4. #3
    Sencha Premium User
    Join Date
    Feb 2016
    Posts
    63

    Default

    Hi Daniel,

    Adding root does seem to help. Thanks.
    Thanks,
    Amit

Similar Threads

  1. Replies: 15
    Last Post: 17 Dec 2014, 1:44 AM
  2. Replies: 1
    Last Post: 26 Jul 2011, 4:15 AM
  3. Replies: 2
    Last Post: 16 May 2011, 10:03 PM
  4. remote combobox on toolbar not working, but working when on FormPanel
    By norizam61 in forum Ext 3.x: Help & Discussion
    Replies: 0
    Last Post: 7 May 2010, 8:48 PM

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
  •