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.

Source: Internet
Author: User

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 ");
}
}
});

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.