Greetings, I'm new to the forum and prime ui.
I'm trying to create a lazy tree.
In the documentation, nodes are loaded from a URL providing rest based service.
I need to load nodes lazily from an ordinary javascript function (not from a URL). The reason is nodes are created dynamically/programmatically by the user, I do not have a chance of getting nodes from a server service.
Is this possible using prime ui? Can you post an example?
Thanks in advance.
Prime UI tree lazy loading
Hi,
You can't add or remove tree nodes dynamically because no method exists in the puitree for this purpose.
The only way I found is to destroy and recreate the puitree each time its structure is updated, but it's only suitable if your tree does not contain too much nodes.
Example of puitree initialization from a javascript variable :
Exemple of puitree widget removal :
Regards,
Pascal
You can't add or remove tree nodes dynamically because no method exists in the puitree for this purpose.
The only way I found is to destroy and recreate the puitree each time its structure is updated, but it's only suitable if your tree does not contain too much nodes.
Example of puitree initialization from a javascript variable :
Code: Select all
$('#mytree').puitree({
lazy: false,
nodes: function(ui, response) {
var data = [{"label":"Node 0","data":"0","children":[{"label":"Node 10","data":"10"}]}];
response.call(this, data);
}
});
Code: Select all
$('#mytree').remove();
Pascal
Last edited by pmc34 on 02 Aug 2014, 18:23, edited 1 time in total.
-
- Posts: 3
- Joined: 23 Jul 2014, 08:35
Merci Pascal.
The last line worked as response.call(this,data,ui.node) in my end, for your information.
The last line worked as response.call(this,data,ui.node) in my end, for your information.
-
- Information
-
Who is online
Users browsing this forum: No registered users and 24 guests