Hereby an issue which has kept me busy for quite a while.
When using method treetable() to dynamically add a new child under a given node, I was expecting that the parent id of the child node would be set within the call. However, I discovered by trial and error I had to set it explicitly.
Eg. I had to do the folowing; given a new row definition in $(new_row):
// Determine the parent node from a given id
var parent_node = $('#tree_table').treetable("node", parent_id);
// Explicitly set the parent id
$(new_row).attr('data-tt-parent-id', parent_id); // !!! Superfluous !!!
// Add new node to parent
$('#tree_table').treetable("loadBranch", parent_node, new_row);
If you don't do this, the new node will be added as a top node.
Since the parent_node is explicitly specified, having to explicitly set the data-tt-parent-id attribute should not be necessary. The necessary info has already been passed by means of parameter parent_node.
Hereby an issue which has kept me busy for quite a while.
When using method treetable() to dynamically add a new child under a given node, I was expecting that the parent id of the child node would be set within the call. However, I discovered by trial and error I had to set it explicitly.
Eg. I had to do the folowing; given a new row definition in $(new_row):
If you don't do this, the new node will be added as a top node.
Since the parent_node is explicitly specified, having to explicitly set the data-tt-parent-id attribute should not be necessary. The necessary info has already been passed by means of parameter parent_node.