The EasyUI node is displayed but not selected when you click the text of a subnode in easyui. The function is selected only when you click the final subnode.
In recent projects, you will always need to expand the directory when you click a sub-node in the tree directory, and click the final sub-node to achieve the selected function. Below I will paste the Code directly, which is very easy to understand. The key is to add a judgment in the selected event.
$ ('# Repairtid'). combotree ({
Url: '/RepairSub/GetRepTypeZ /? UserRole = 5 ',
Required: true,
PanelHeight: 'auto ',
OnLoadSuccess: function (node, data ){
If (data! = Null ){
// Expand all during loading
$ ('# Repairtid'). combotree ('tree'). tree ("collapseAll ");
// Set the selected items by default
$ ('# RepairTID'). combotree ('setvalue', {id: 0 });
}
},
OnSelect: function (node ){
Var tree = $ (this). tree;
// Check whether the selected node is a leaf node. If not, clear the selected node.
$ (This). tree (node. state = 'closed '? 'Expand': 'collapse', node.tar get );
Var isLeaf = tree ('isleaf', node.tar get );
If (! IsLeaf ){
// Clear the selected
// $ ('# Rep_AreaID'). combotree ('clear ');
$ ("# RepairTID"). tree ("unselect ");
}
}
});