IT small meat Widgets Tree single-choice, multiple-choice, related callback function, obtain the selected node function, widgets callback function
Writing a tree control is not as easy as you think. Today I spent more than an hour, IT adds single-choice, multi-choice, pre-selection, and post-selection callback functions for the IT fresh meat Widgets Tree control to obtain the selected node functions. Efforts will be made to improve the tree control later.
1. Set the options during initialization{select:
true
}
Enable single choice and set the options during initialization{select:{type:
'multiple'
} Enable multiple choice
The example code is as follows:
The running effect is as follows:
2. added the onBeforeSelect callback function to implement custom selection. If this function returns false, the default selection behavior will be interrupted.
The example code is as follows:
The running effect is as follows:
The "Ningbo" node is unavailable.
3. added the onAfterSelect callback function. The Listener selects the end event. This function is called whether a node is selected or a node is selected.
4. added the function of calling tree. itxxr_tree ('getselected') to obtain the selected node.
The example code is as follows:
The running result is as follows: