Home > Web Front-end > JS Tutorial > body text

Examples explaining how to use the state attribute in jQuery EasyUI tree with caution

高洛峰
Release: 2016-12-29 13:47:20
Original
1331 people have browsed it

EasyUI 1.4.4 In the tree control, if it is a leaf node, do not set the state to closed, otherwise the node will load the entire tree, forming an infinite loop

For example:

json enter the following:

[
{
"checked": false,
"iconCls": "",
"id": "dec",
"pid": "",
"state": "closed",
"text": "test",
"type": "ORG"
}
]
Copy after login

实例讲解jQuery EasyUI tree中state属性慎用

The status is changed to open or empty, and the display is normal

实例讲解jQuery EasyUI tree中state属性慎用

Below Let me introduce to you the use of easyui tree custom attributes

Children who know the easyui tree component probably know that the node of the tree has its own separate attributes (id, text, iconCls, checked, state, attribute, target). However, if you want to assign these attributes to instances through HTML, it cannot be completely done. The attribute attribute must be assigned in json format. This also brought some inconvenience to our development. But now with the attribute data-options, all problems are solved.

Defining a nide node with special attributes can be implemented in the following way

<ul id="tt" class="easyui-tree" data-options="animate:true,dnd:true">
<li>
<span>Folder</span>
<ul>
<li data-options="state:&#39;closed&#39;">
<span>Sub Folder </span>
<ul>
<li data-options="attributes:{&#39;url&#39;:&#39;xxxxx&#39;}">
<span><a href="#">File </a></span>
</li>
<li data-options="attributes:{&#39;url&#39;:&#39;xxxxx&#39;}">
<span>File </span>
</li>
<li>
<span>File </span>
</li>
</ul>
</li>
<li data-options="attributes:{&#39;url&#39;:&#39;xxxxx&#39;}">
<span>File </span>
</li>
<li data-options="attributes:{&#39;url&#39;:&#39;xxxxx&#39;}">
<span>File </span>
</li>
<li id="" data-options="attributes:{&#39;url&#39;:&#39;xxxxx&#39;}">File </li>
<li>File </li>
</ul>
</li>
<li>
<span>File</span>
</li>
</ul>
Copy after login

Then when we obtain the node object of the tree through the js method, we can directly node .attributes.url has obtained the corresponding value.

For more examples to explain the careful use of the state attribute in jQuery EasyUI tree, please pay attention to the PHP Chinese website for related articles!


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template