Results 1 to 3 of 3

Thread: Where is TreeStore's setRoot() method?

  1. #1
    Sencha User
    Join Date
    Oct 2016
    Posts
    36
    Answers
    2

    Default Answered: Where is TreeStore's setRoot() method?

    I didn't find the method in the source code,
    please help me,thanks~

  2. Since it is a member of the config object http://docs.sencha.com/extjs/6.2.1/c...js.html#line65,
    the getter and setter of TreeStore's root property are auto-generated by ExtJS.
    This means setRoot has no dedicated own code.

    The automatic creation of setters and getters takes place in
    http://docs.sencha.com/extjs/6.2.1/c...s.html#line272 for setters and
    http://docs.sencha.com/extjs/6.2.1/c...s.html#line241 for getters
    in the private Ext.Config class http://docs.sencha.com/extjs/6.2.1/c...xt.Config.html.

    In this Fiddle you can explore how it all works using your browser's Dev Tools:
    https://fiddle.sencha.com/#view/editor&fiddle/1rml


    Kind regards, clampart

  3. #2
    Sencha User yeghikyan's Avatar
    Join Date
    Mar 2009
    Location
    München
    Posts
    574
    Answers
    99

    Default

    Code:
    var store = Ext.create('Ext.data.TreeStore', {});
    
    // HERE
    store.setRoot({
            expanded: true,
            children: [
                { text: 'detention', leaf: true },
                { text: 'homework', expanded: true, children: [
                    { text: 'book report', leaf: true },
                    { text: 'algebra', leaf: true}
                ] },
                { text: 'buy lottery tickets', leaf: true }
            ]
        });
    
    
    
    Ext.create('Ext.tree.Panel', {
        title: 'Simple Tree',
        width: 200,
        height: 200,
        store: store,
        rootVisible: false,
        renderTo: Ext.getBody()
    });
    "The competent programmer is fully aware of the strictly limited size of his own skull; therefore he approaches the programming task in full humility, and among other things he avoids clever tricks like the plague." – Edsger W. Dijkstra

  4. #3
    Sencha Premium User
    Join Date
    Sep 2016
    Location
    Germany
    Posts
    37
    Answers
    1

    Default

    Since it is a member of the config object http://docs.sencha.com/extjs/6.2.1/c...js.html#line65,
    the getter and setter of TreeStore's root property are auto-generated by ExtJS.
    This means setRoot has no dedicated own code.

    The automatic creation of setters and getters takes place in
    http://docs.sencha.com/extjs/6.2.1/c...s.html#line272 for setters and
    http://docs.sencha.com/extjs/6.2.1/c...s.html#line241 for getters
    in the private Ext.Config class http://docs.sencha.com/extjs/6.2.1/c...xt.Config.html.

    In this Fiddle you can explore how it all works using your browser's Dev Tools:
    https://fiddle.sencha.com/#view/editor&fiddle/1rml


    Kind regards, clampart

Similar Threads

  1. [FIXED] [docs] Ext.data.TreeStore#setRoot is not shown in documentation
    By incutonez in forum Ext JS 6.x Bugs
    Replies: 1
    Last Post: 3 Nov 2016, 4:00 PM
  2. Replies: 2
    Last Post: 24 May 2016, 1:26 AM
  3. [FIXED] TreeStore.setRoot problem?
    By Ronaldo in forum Ext 5: Bugs
    Replies: 3
    Last Post: 15 Jul 2015, 12:49 AM
  4. Replies: 1
    Last Post: 2 Feb 2015, 7:57 AM
  5. [FIXED] TreeStore setRoot doesn't work in ST 2.0.1.1
    By bionicmaster in forum Sencha Touch 2.x: Bugs
    Replies: 8
    Last Post: 30 Oct 2013, 6:19 AM

Posting Permissions

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