Hi Boram,
Thanks for contacting syncfusion support
Query 1: In tree view, I can't select node by text
At present we cannot select the node using text. To select tree node, you have to use the ID of corresponding node or node element. Please refer to the below code example to select newly added tree node.
Code example [JavaScript]:
var treeview = $("#treeview").data("ejTreeView"); var newText = "NewItem" + count++; var newnode = { id: newText, name: newText }; treeview.addNode(newnode); treeview.selectNode($("#" + newText)); |
Query 2: How can attach javascript event, say nodeSelect and nodeDropped, on this treeview knockout sample?
In tree view knockout, we can attach the tree view events like other API Members of tree view. In the below code example, we have specified “nodeSelect” and “nodeDropped” treeview event for your reference.
Code example[HTML]
<div id="treeview" data-bind="ejTreeView: {fields :{ dataSource: dataSource,id:'id',text:'name',hasChild:'hasChild',expanded:'expanded',parentId:'pid'}, allowDragAndDrop: true, nodeSelect:'onSelect', nodeDropped:'onDropped' } "></div> <script type="text/javascript"> function onSelect(args) { // event handling codes } function onDropped(args) { // event handling codes } </script> |
Query3: I want to place 'Delete' button beside treeview and I want the button be enabled only when any node is selected and I want to that by knockoutjs way by "enable: ~~~".
As shown in the below code example, we need to render button with disabled mode and have to enable this button at the time of treeview “nodeSelect” event.
Code example[HTML]
<button id="Button1" data-bind="ejButton:{enabled: false, click:'onDelete'}" >Delete</button> <script type="text/javascript"> //treeview "nodeSelect" select event calls this method function onSelect(args) { //button will be anabled $("#Button1").ejButton({enabled: true}); } </script> |
We have prepared a sample based on this and you can find the sample under the following location:
Sample : http://www.syncfusion.com/downloads/support/forum/120106/ze/Treeview968798673
Please refer below online link to know more details
Online link: http://docs.syncfusion.com/
Please let us know if this helps.
Regards,
Balamurugan