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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Get custom values of checked nodes

Thread ID:





123429 Mar 16,2016 03:51 PM UTC Aug 17,2016 01:53 PM UTC JavaScript 3
Tags: ejTreeView
Asked On March 16, 2016 03:51 PM UTC

Hi Team,

I'm trying to use the tree view with checkbox and in the data source I included several custom values. How do I get the custom values of a checked node once  #btnDummy is clicked?
I'm using the Vol3 SP1 (2015) - v13.3.0.12 library, as I understand it, getCheckedNodesIndex() doesn't work in this early version.


$(function () {


                  type: "POST",

                  url: "../SampleController/GetTreeViewData",

                  data: {},

                  success: function (res) {


                           fields: { id: "ID", parentId: "PID", text: "Name", hasChild: "HasChild", dataSource: res }, 

                           showCheckbox: true,



                 error: function (xhr, status, error) {



                 datatype: "json"                



Gobalakrishnan S [Syncfusion]
Replied On March 17, 2016 02:13 PM UTC

Hi Lory,
Thanks for using Syncfusion products,
Query: How do I get the custom values of a checked node once #btnDummy is clicked?

We can achieve your requirement using our existing method called “getTreeData” that return the list of tree view data. By specifying the checked node index value ( get checked node index using getCheckedNodesIndex method) in the tree view data list and get the custom values of the specified index. Please find the code snippet as follows:

      function getCustomValue() {

          // To get entrie tree data.

            var data = treeObj.getTreeData();

          // To get the checked node index value.

            var checkedIndex = treeObj.getCheckedNodesIndex();

          // To get the checkded node object.  data[checked node index]

           checkedNodeObj = data[12];   // 12 is one of the checked node index.

          // you can get the custom values from the node object.


For your convenience, we have prepared the JSPlayGroundSample .Please find the sample as follows:


In the above sample, while clicking the button, we get the entire tree view data using the “getTreeData” method. By specifying the checked node index value in the tree view data and we have get the custom values of the specified index.

Please check with the given solution, if we have misunderstood your query, please provide us more details about the requirement with code snippet. This will help us to provide the exact solution to the requirement.

Query: “getCheckedNodesIndex()” doesn't work in this early version.

We are unable to reproduce the reported issue “getCheckedNodesIndex()” doesn't work in this early version” on our end. We have prepared a sample with “getCheckedNodesIndex”.Please find the sample on the above JSPlayGroundSample link.

Please check with given sample and if you are still facing any issues, please provide more information about your issue and also revert the sample with replication procedure. This will help us to provide the exact solution.

Please let me know, if you have any further assistance


Gobalakrishnan S

Replied On August 16, 2016 05:25 PM UTC

I am using similar with ASP MVC C#, can you tell me how to send and get checked values of the list to POST on the serverside

Piramanayagam Ramakrishnan [Syncfusion]
Replied On August 17, 2016 01:53 PM UTC

Hi Lory, 
Thanks for your update. 
We have analyzed your query. You can achieve your requirement (“how to send and get checked values of the list to POST on the server side”) by using AJAX in application level. You can pass the checked node values to server side and you can access these details from controller action. Please refer the below code sample. 
$("#btn").click(function () { 
    var treeObj = $("#tree").data("ejTreeView"); 
    var widgets = { checkedNodes: treeObj.getCheckedNodesIndex() };//get the index of checked nodes 
        url: '/Home/About', 
        type: 'POST', 
        dataType: 'json', 
        data: JSON.stringify(widgets), 
        contentType: 'application/json; charset=utf-8', 
        success: function (result) { 
            $("#demo").html("Current Checked Nodes are: " + result.toString()); 
public JsonResult About(IEnumerable<int> checkedNodes) 
    if (checkedNodes == null) 
        return Json(""); 
    return Json(checkedNodes, JsonRequestBehavior.AllowGet); 
We have prepared the sample based on your requirement and it can be downloaded from the below location: Sample 
Are you expecting this? Or please provide the more details about your requirement this would be helpful for us to identify your exact requirement and provide a solution at the earliest. 
Piramanayagam R 


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon