Hi all,

how can i bind a tree.virtualTree to a qx.ui.table ?

The Bind to a List works fine, but i would bind the selection of a tree to a
table.

i would bind the serverInterfaces (Json Response) to the table, if anyone
select a Server in the virtualTree,
then the table would show the Interfaces from the selected Server, that's
the target.

Can anyone please help me with that issue ? 

/*
 * JSON Response:
 */
{"success":true,"totalCount":1,"serverDetails":[{
                                                        "id":"36",
                                                        "serverName":"NOBODY",
                                                        
"serverSNMPMemory":"1028700 KBytes",
                                                        
"serverSNMPDescription":"Linux NOBODY 2.6.24-26-server #1 SMP Tue Dec
1 18:26:43 UTC 2009 x86_64",
                                                        
"serverSNMPHardware":"Intel/AMD x64",
                                                        
"serverSNMPSoftware":"2.6.24-26-server",
                                                        
"serverSNMPFeatures":"Multiprocessor",
                                                        
"serverSNMPServiceTag":"",
                                                        
"serverSNMPLocation":"Virtual Server on NOBODY1",
                                                        
"serverSNMPLastUpdate":"2010-11-25 12:36:13",
                                                        
"serverDescription":"Linux NOBODY 2.6.24-26-server #1 SMP Tue Dec 1
18:26:43 UTC 2009 x86_64",
                                                        
"serverDracIpAddress":"",
                                                        
"serverExpressionCode":"",
                                                        
"serverFeatures":"Multiprocessor",
                                                        
"serverHardware":"Intel/AMD x64",
                                                        
"serverLastUpdate":"0000-00-00 00:00:00",
                                                        
"serverLocation":"Virtual Server on NOBODY1",
                                                        "serverMemory":"1028700 
KBytes",
                                                        "serverServiceTag":"",
                                                        
"serverSoftware":"2.6.24-26-server",
                                                        "serverSupportID":"0",
                                                        
"serverSupportToDate":"0000-00-00",
                                                        
"serverSupportTelefon":"",
                                                        
"serverSupportMobile":"",
                                                        
"serverSupportStreet":"",
                                                        "serverSupportPlz":"",
                                                        "serverSupportCity":"",
                                                        
"serverSupportCountry":"",
                                                        
"serverSupportCompany":"",
                                                        
"serverSupportPosition":"",
                                                        
"serverSupportAbteilung":"",
                                                        
"serverSupportFirstName":"",
                                                        
"serverSupportLastName":"",
                                                        "serverInterfaces":[{
                                                                        "id":91,
                                                                        
"ifName":"eth0",
                                                                        
"ifIP":"10.xx.xx.xx",
                                                                        
"ifNetmask":"255.255.0.0",
                                                                        
"ifSpeed":"10000000",
                                                                        
"ifType":"ethernet-csmacd",
                                                                        
"ifMACAddress":"0:xx:xx:xx:xx:xx",
                                                                        
"ifStatus":"1"
                                        },{
                                                                        "id":92,
                                                                        
"ifName":"lo",
                                                                        
"ifIP":"127.0.0.1",
                                                                        
"ifNetmask":"255.0.0.0",
                                                                        
"ifSpeed":"10000000",
                                                                        
"ifType":"softwareLoopback",
                                                                        
"ifMACAddress":"none",
                                                                        
"ifStatus":"1"
                                        }]
                                }]}


/*
 * Tree Server List
 */
qx.Class.define("app.view.desktop.ServerListe",
{
        extend : qx.ui.container.Composite,

        construct : function()
        {
                this.base(arguments);


                var layout = new qx.ui.layout.HBox(0);
                this.setLayout(layout);

                this.setWidth(220);


                var tree = qx.core.Init.getApplication().__serverTree = new
qx.ui.tree.VirtualTree(null, "name", "kids", "icon");
                tree.setWidth(220);
                tree.setHideRoot(true);

                // icon options
                tree.setIconPath("icon");
                tree.setIconOptions({
                        converter : function(value, model){
                                return "icon/22/"+model.getIcon()+".png";
                        }
                });

                tree.bind("selection",tree,"selection");

                // create the data store
                var url_serverListe =
"resource/app/remote/get_serverListe.php?node=all";
                var store_serverListe =
qx.core.Init.getApplication().__serverTree_Store = new
qx.data.store.Json(url_serverListe);

                // connect the store and the tree
                store_serverListe.bind("model", tree, "model");

                tree.getSelection().addListener("change", function(e){
                        var selection = tree.getSelection();
                        if(selection.getLength() > 0) {
                                this.__selectedServerID =
selection.getItem(0).getId();
                                console.log("tree_serverListe: ServerID = "
+ selection.getItem(0).getId());

                                var response_serverDetails = new
app.modules.server_details.get_ServerDetails(this.__selectedServerID);
                        };
                },this);

                console.log("store_serverListe bind ...");

                // show the data in the list when loaded
                store_serverListe.addListener("loaded", function(ev) {
                        console.log("store_serverListe.addListener");
                });
                this.add(tree);
        }
});

/*
 * Table 
 */
qx.Class.define("app.view.desktop.ServerDetails_GroupBox_Interfaces",
{
        extend : qx.ui.groupbox.GroupBox,

        construct : function()
        {
                this.base(arguments,"Server Interfaces");

                ////////////////// Server Details ////////////////////
                this.setLayout(new qx.ui.layout.VBox());

                var tableModel = new qx.ui.table.model.Simple();
                tableModel.setColumns([ "ID", "Name", "IP Address",
"Netmask", "MAC Address", "Speed", "Status" ]);

                var custom = {
                        tableColumnModel : function(obj) {
                                return new
qx.ui.table.columnmodel.Resize(obj);
                        }
                };

                var table = new qx.ui.table.Table(tableModel,custom);

                var col = table.getTableColumnModel().getBehavior();
                col.setWidth(0,"1*");
                col.setWidth(1,"1*");
                col.setWidth(2,137);
                col.setWidth(3,137);
                col.setWidth(4,40);
                col.setWidth(5,"1*");
                col.setWidth(6,47);

                var colMod = table.getTableColumnModel();
                colMod.setColumnVisible(0, false);      // show ID == FALSE

//             
qx.core.Init.getApplication().__serverTree.bind("selection",table,"model");

                this.add(table);

/* THIS WILL WORK FOR A LIST: 
                var list_ServerInterfaces               = new
qx.ui.form.List("Interfaces");
                var list_ServerInterfaces_Controller    = new
qx.data.controller.List(null, list_ServerInterfaces, "name");
               
qx.core.Init.getApplication().__serverTree.bind("selection",list_ServerInterfaces_Controller,"model");
                this.add(list_ServerInterfaces);

 */

        }
});

thanks and regards
Mikesch

--
View this message in context: 
http://qooxdoo.678.n2.nabble.com/Need-Help-HowTo-tree-virtualTree-bind-qx-ui-table-tp7138601p7138601.html
Sent from the qooxdoo mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
infrastructure or vast IT resources to deliver seamless, secure access to
virtual desktops. With this all-in-one solution, easily deploy virtual 
desktops for less than the cost of PCs and save 60% on VDI infrastructure 
costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to