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

Reply via email to