1. #1
    Sencha Premium Member
    Join Date
    Jul 2011
    Posts
    18
    Answers
    1
    Vote Rating
    0
    jonas007 is on a distinguished road

      0  

    Default Answered: How to create a picker that displays a tree?

    Answered: How to create a picker that displays a tree?


    I want to create e special PickerField, that displays a tree.
    I assumed that the function createPicker must return only a tree (Ext.tree.View). But if I now click on the button of the picker, nothing happens. Does anybody advice how a picker can be built that will display a tree?
    Thank you

  2. You could maybe use this as a starting point:

    Code:
    Ext.create('Ext.form.field.Picker', {
        renderTo: Ext.getBody(),
    
        createPicker: function() {
            return Ext.create('Ext.tree.Panel', {
                floating: true,
                hidden: true,
                minHeight: 300,
                root: {
                    expanded: true,
                    text: 'Root',
                    children: [
                        {text: 'Child 1', children: []},
                        {text: 'Child 2', children: []},
                        {text: 'Child 3', children: []}
                    ]
                }
            });
        }
    });

  3. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,330
    Answers
    3541
    Vote Rating
    847
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Is the tree actually rendered in the DOM? What is happening?
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  4. #3
    Sencha Premium Member skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,605
    Answers
    543
    Vote Rating
    326
    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


    You could maybe use this as a starting point:

    Code:
    Ext.create('Ext.form.field.Picker', {
        renderTo: Ext.getBody(),
    
        createPicker: function() {
            return Ext.create('Ext.tree.Panel', {
                floating: true,
                hidden: true,
                minHeight: 300,
                root: {
                    expanded: true,
                    text: 'Root',
                    children: [
                        {text: 'Child 1', children: []},
                        {text: 'Child 2', children: []},
                        {text: 'Child 3', children: []}
                    ]
                }
            });
        }
    });

  5. #4
    Sencha Premium Member
    Join Date
    Jul 2011
    Posts
    18
    Answers
    1
    Vote Rating
    0
    jonas007 is on a distinguished road

      0  

    Default


    Thanks. The problem was to build the picker correctly. But now it works. If done properly, it is much easier than I thought before.

Thread Participants: 2