ExtJS6 Treepanel tree nodes close up show different icons

Source: Internet
Author: User

Treepanel nodes, such as child nodes, can display different icons when expanded/closed, enhancing client effects and improving the user experience. Very simple, two events using Treepanel: Beforeitemexpand and Beforeitemcollapse.

Ext.define (' Mytreepanel_cls ', {  extend: ' Ext.tree.Panel ',  height:400,  width:300,  store: Mtreestore,  tbar:Ext.create (' treetoolbarcls '),  listeners:  {    function (node, index, item, eopts)    {      node.data.iconCls = ' Folder_open ';    },    function (node, index, item, eopts)    {      node.data.iconCls = ' Folder_close ';}}}  );

On the page to define the Folder_open and folder_close two CSS styles.

. Folder_close{  backgroundurl ("/image/tree/folder_close.ico") No-repeat Center! Important;}. Folder_open{  backgroundurl ("/image/tree/folder_open.ico") No-repeat Center! Important;}

The effect is this:

ExtJS6 Treepanel tree nodes close up show different icons

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.