Today, I changed the icon of Easyui's tree with my work, and went home and tried to change the icon of Webix tree. The following demo is given in the document.
Webix.ui ({ view:"Tree", type:{ folder:function(obj) { If(obj. $level = =1 )return "<span class= ' Webix_icon fa-folder-open ' ></span > "; if (obj. $level = =2 ) return "<span class= ' Webix_icon fa-video-camera ' ></span>"; }} );
View the source code to discover that obj is the data for each node in data. His original icon seems to be a certain style, there is no overlay, imitate Easyui tree plus iconcls can change the icon to redefine the next type of Foder. As follows
Webix has a lot of icons, here are a few of the life of the icons often appear, the specific icon to see another essay. More than 500 kinds are listed. The code is as follows
<!DOCTYPE HTML><HTML><HeadLang= "en"> <MetaCharSet= "UTF-8"> <Linkrel= "stylesheet"href= "Http://cdn.webix.com/edge/webix.css"type= "Text/css"Media= "Screen"CharSet= "Utf-8"> <Scriptsrc= "Http://cdn.webix.com/edge/webix.js"type= "Text/javascript"CharSet= "Utf-8"></Script> <title>Webix Tree Tags</title></Head><Body><Script>Webix.ui ({view:"Tree", Width:260, drag:true, type: {folder: function (obj) { if (obj.iconcls) return "<span class= ' Webix_icon fa-" + obj.iconcls + " ' ></span> "; }}, data: [{open:true, Value:"Configuration Management", iconcls: "cogs" , data: [{iconcls:"COG", Value:"Stock Management"}, {iconcls:"Leaf", Value:"Shipping Management"}, {iconcls:"Heart", Value:"Configure Publishing"}]}, {value:"Report Management", open:true, Iconcls:"Bar-chart-o", data: [{iconcls:"QQ", Value:"Access Volume report"}]}, {value:"Account Management", Iconcls:"WeChat", open:true, data: [{iconcls:"Android", Value:"Personal account Management"}, {iconcls:"Apple", Value:"System Account Management" }] }],
On: {
"Onitemclick": function (ID) {
var item = This.getitem (ID);
Webix.alert ({title: "Hint", text:item.value});
}
}
</ Script >
</ Body >
</ HTML >
Red part of the code, is the key to change the icon, you can directly put in the HTML file, open to see the effect. There are many different styles of Webix, and I use Gray. You may be in color.
Webix is the JS front-end frame, the entire code except <body>. Almost all are JS,. If you are developing in single-page mode. Just write a index.html file. The entire system front-end can be completed with JS.
enough to 150. The number of words--------------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------- -----------------------------------------
Webix.tree Modify icon