Transform the Folderselect style of the ace_tree component of the Ace Admin template

Source: Internet
Author: User
Tags php language

* Note: I use the ACE Admin version for 1.3.4

Ace Admin is a lightweight, feature-rich, HTML5, responsive, smart management background template that supports browsing on mobile phones and tablets.

For the use of the tree, the HTML folder under the treeview.html gives static data example, examples under treeview.html to the dynamic PHP language example.

But the TreeView under Exmaple, when the parameter "Folderselect=true"::

When the point is open,

Can no longer be put away, and I want to change into folder Click Select, also like item style,

The transformation is as follows: 1. First fix treeview.html, find $ (' #treeview '). Ace_tree, fix as follows:

$ (' #treeview '). Ace_tree ({datasource:remotedatesource, MultiSelect:true, loadinghtml:' <div class= ' tree-loading "><i class=" Ace-icon fa fa-refresh fa-spin Blue ></i></div> ',    ' Open-icon ': ' Ace-icon tree-minus hide ',    ' Close-icon ': ' Ace-icon tree-plus hide ',    ' Selectable ':true,    ' Selected-icon ': ' Ace-icon fa Fa-check ',    ' Unselected-icon ': ' Ace-icon fa fa-times ',    ' Cacheitems ':true,    ' Folderselect ':true,    ' Folder-open-icon ': ' Ace-icon tree-plus ',    ' Folder-close-icon ': ' Ace-icon tree-minus '});

Next, find the associated JS file ace-elements.js, open after finding the Acetree related section, in

<i class= "Icon-folder" + $options [' Close-icon ']+ ' "></i>\

Insert a row after

' + ($options [' Folderselect ']? ($options [' unselected-icon '] = = null? ': ' <i class= ' icon-item ' + $options [' Unselected-icon ']+ ' "></i> '): ') + ' \

Then, open "/fuelux/fuelux.tree.js", locate the Selecttreenode property, and

if (NodeType = = = ' folder ')    {// make the clicked. $element the Container branch    clicked. $element = clicked. $element. Closest ('. Tree-branch ');     = clicked. $element. Find ('. Icon-folder ');} Else {    = clicked. $element. Find ('. Icon-item ');}

Change into

if (NodeType = = = ' folder ')    {// make the clicked. $element the Container branch    clicked. $element = clicked. $element. Closest ('. Tree-branch ');     = clicked. $element. Find ('. Icon-item ');} Else {    = clicked. $element. Find ('. Icon-item ');}

Find the Stylenodeselected method and add it to the method

if ($element. Data (' type ') = = = ' folder ' && $icon. Hasclass (self.options[' Unselected-icon ')){       $icon. Removeclass (' Fueluxicon-bullet '). addclass (' Glyphicon-ok ');//Make checkmark    //  ACE}

Find the Stylenodedeselected method and add it to the method

if ($element. Data (' type ') = = = ' folder ' && $icon. Hasclass (self.options[' Selected-icon '))    {//  $icon. Removeclass (' Fueluxicon-bullet '). addclass (' Glyphicon-ok ');//Make checkmark    // ACE}

This way, the jquery code is changed, and finally the CSS is added to the treeview.html.

. Tree. Tree-branch >. tree-branch-header >. tree-branch-name >. Icon-item{Color:#F9E8CE;width:13px;Height:13px;Line-height:13px;font-size:11px;text-align:Center;Border-radius:3px;-webkit-box-sizing:Content-box;-moz-box-sizing:Content-box;box-sizing:Content-box;Background-color:#FAFAFA;Border:1px solid #CCC;Box-shadow:0 1px 2px rgba (0, 0, 0, 0.05);}. Tree. tree-selected >. tree-branch-header >. tree-branch-name >. Icon-item{Background-color:#F9A021;Border-color:#F9A021;Color:#FFF;}

So you can become a beautiful multi-select Tree Menu

Transform the Folderselect style of the ace_tree component of the Ace Admin template

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.