Return node data by id of the record.
Parameters
Name | Type | Description |
---|---|---|
id | {string|number} | The id of the record that needs to be returned |
Examples
sample
<button id="btnGetData" class="gj-button-md">Get Data</button>
<br/>
<div id="tree"></div>
<script>
var tree = $('#tree').tree({
dataSource: '/Locations/Get',
primaryKey: 'id' //define the name of the column that you want to use as ID here.
});
$('#btnGetData').on('click', function () {
var data = tree.getDataById(9);
alert('The population of ' + data.text + ' is ' + data.population);
});
</script>