Results 1 to 4 of 4

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

  1. #1
    Sencha Premium Member
    Join Date
    Jul 2011
    Posts
    18
    Answers
    1
    Vote Rating
    0
      0  

    Default 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 - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,324
    Answers
    3884
    Vote Rating
    1297
      0  

    Default

    Is the tree actually rendered in the DOM? What is happening?
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it!

    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,790
    Answers
    583
    Vote Rating
    390
      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
      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.

Posting Permissions

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