PDA

View Full Version : How to create a picker that displays a tree?



jonas007
23 Jan 2012, 3:01 AM
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

mitchellsimoens
23 Jan 2012, 12:13 PM
Is the tree actually rendered in the DOM? What is happening?

skirtle
23 Jan 2012, 4:47 PM
You could maybe use this as a starting point:


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: []}
]
}
});
}
});

jonas007
23 Jan 2012, 11:27 PM
Thanks. The problem was to build the picker correctly. But now it works. If done properly, it is much easier than I thought before.:)