We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Click / Select treeview node also checks the Checkbox

Hi,
Is it possible that when selecting / clicking on a treeview node that this action would also check the  Checkbox when showcheckbox is equal to true.

Cheers ... Rob.

1 Reply

SN Sasikala Nagarajan Syncfusion Team May 12, 2015 09:58 AM UTC

Hi Robert,

Thanks for using Syncfusion products,

We have analyzed your requirement and we have achieved this by customizing the treeview functionalities in node click event.

Please refer the below code snippet

<script type="text/javascript">

var treeObj;

$(function () {

$("#treeView").ejTreeView({ expandOn:"",showCheckbox: true,nodeClick:"selectCheckBox"});

treeObj= $("#treeView").ejTreeView('instance');

});


function selectCheckBox(args) {

if(args.currentElement.nodeName=="A") {

var element=$(args.currentElement).parents("li.e-item")[0];

isChecked=$("#treeView").ejTreeView("isNodeChecked",element);

!isChecked ? treeObj.checkNode(element):treeObj.uncheckNode(element);

}

}

</script>


In this we have disabled the “expand and collapse in double click” by setting “expandOn” as empty string (“”).


For your convenience we have prepared the simple sample based on this it can be downloaded from below location.

Sample,

Please check with the given sample and let us know if you have further queries.

Regards,

Sasikala Nagarajan


Loader.
Live Chat Icon For mobile
Up arrow icon