Update node from the tree.
Parameters
Name | Type | Description |
---|---|---|
id | {string} | The id of the node that needs to be updated |
record | {object} | The node as jQuery object |
Examples
Method Sample
<input type="text" id="nodeName" />
<button onclick="save()" class="gj-button-md">Save</button>
<br/>
<div id="tree"></div>
<script>
var tree = $('#tree').tree({
primaryKey: 'id',
dataSource: '/Locations/Get'
});
tree.on('select', function (e, node, id) {
$('#nodeName').val(tree.getDataById(id).text);
});
function save() {
var id = tree.getSelections()[0],
record = tree.getDataById(id);
record.text = $('#nodeName').val();
tree.updateNode(id, record);
}
</script>