Hi Luke,

I don't get all what you are trying to to but I try to answer everything I
get.
1. Creating tree files and tree folders is not really necessary. Just use
folders all the time and set the icon to the type you want. That would make
the taks much easier. The only difference in qooxdoo is the styling so it
really should not be a problem creating folders all the time.
2. Syncing the selection is not that hard than you think. Every tree folder
has a property called model where its representative model object is
available. Therefore, you can bind the selection of your model to the
modelSelection of the selectbox:
treeItem.bind("model.sel", treeItem.getUserData('sel'), "modelSelection);
But binding the model selection means that the at least one ListItems in the
SelectBox need to have the set model stored in its model property.
3. We can use the same model property for the button listener: 
button.addListener("execute", function(){
  this.info(treeItem.getModel().getId());
});
I hope those info helps you a bit to get closer to your goal.
Seasonal greetings,
Martin



lp1051 wrote:
> 
> 
> Good morning,
> 
> I see that higher number of qooxdoo widgets inside Tree, generates
> "Unresponsive script" dialog. I know, Derrell warned me, 
> so now I am trying some optimizations. I started with tree data
> controller,
> tree model and binding with delegate options, as it seems to speed things
> up.
> But! Not much success...
> Here is snippet of code :
> 
> * from this model I want to create Folder items from 1st level kids and
> File
> items from kids on 2nd level
> * addListener to button with proper "id" of item (could be maybe solved by
> setting userData('id'), but don't know how to assign it in the delegate
> option)
> * select item from SelectBox based on value of "sel"
> 
> var data = {
>        name: "root",
>        kids: [
>                {name: "folder1", sel:1, id:1, kids: [{name: "file1", sel:3, 
> id:3}]},
>                {name: "folder2", sel:2, id:2, kids: [{name: "file1", sel:1, 
> id:4},
> {name: "file2", sel:3, id:5}]}
>        ]
> };
> 
> model = qx.data.marshal.Json.createModel(data);
> 
> var tree = new qx.ui.tree.Tree();
> this.getRoot().add(tree);
> 
> controller = new qx.data.controller.Tree(model, tree, "kids", "name");
> 
> 
> But how can I then write createItem and configureItem methods? The
> following
> piece is rather pseudo code, that creates only Folders with the additional
> widgets in other columns.
> 
> var delegate =
> {
>               createItem: function() {
>                       var treeItem = new qx.ui.tree.TreeFolder();
>                       treeItem.addWidget(new qx.ui.core.Spacer(), {flex: 1});
>                       
>                       treeItem.setUserData('sel',new qx.ui.form.SelectBox());
>                       treeItem.addWidget(treeItem.getUserData('sel'));
>                       
>                       var button = new qx.ui.form.Button('title', 
> 'icon_path');
>                       treeItem.setUserData('but', button);
>                       treeItem.addWidget(button);
>                       button.addListener("execute", function(){this.info('id 
> of treeItem is 
> '+treeItem.getUserData('id')???)});
> 
>                       treeItem.setOpen(true);
>                
>                       return treeItem; 
>               },
>               configureItem: function(item) {
> 
>               }
> }; 
> 
> Right now it feels like I would need to split the model in two pieces -
> one
> with folders, another with files and for each apply different delegate
> object. 
> I am not sure if it's even possible as data controller needs the path to
> children as well...
> And still, I have no idea how to implement the selection in SelectBox or
> setting userData mentioned in model.
> It reminds me a little of table cell renderer Replace or Conditional, but
> this time it is not a virtual tree...
> 
> I would really appreciate any hint or guidance.
> Thanks,
> Luke
> 
> -- 
> View this message in context:
> http://old.nabble.com/JsonToTree-and-Tree-data-controller-with-delegate-options-usage-tp26840571p26840571.html
> Sent from the qooxdoo-devel mailing list archive at Nabble.com.
> 
> 
> ------------------------------------------------------------------------------
> This SF.Net email is sponsored by the Verizon Developer Community
> Take advantage of Verizon's best-in-class app development support
> A streamlined, 14 day to market process makes app distribution fast and
> easy
> Join now and get one step closer to millions of Verizon customers
> http://p.sf.net/sfu/verizon-dev2dev 
> _______________________________________________
> qooxdoo-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
> 
> 

-- 
View this message in context: 
http://n2.nabble.com/JsonToTree-and-Tree-data-controller-with-delegate-options-usage-tp4185477p4186752.html
Sent from the qooxdoo mailing list archive at Nabble.com.

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to