我需要有一个可从数据库配置的 jstree,但我遇到了图标问题(这只是我查询中包含图标名称的另一列)。问题是我无法正确显示它。
background-image:url('path');
我通过添加属性以将图像指向标签中来构建此列表,<a>
但我一直显示该文件夹图标(图像没有重复,但我将其包含在内以便更容易地可视化问题)。
如何让 jstree 不显示该文件夹?似乎 jstree 只是为整个树(或至少每个级别)构建一个图像。我不知道如何修改它。
这是上图的 html。
<ul style=""><li id="1227_1226" class="leaf jstree-leaf">
<ins class="jstree-icon"> </ins>
<a href="/arco/formatos/Estrategia desarrollo.doc" style="background-image:url('/arco/Menu/images/web.png;');" class="nothing"><ins class="jstree-icon"> </ins>
Instructivo desarrollo
</a>
</li>
<li id="1227_1228" class="leaf jstree-leaf"><ins class="jstree-icon"> </ins>
<a href="/arco/formatos/FO-0001 FormatoMantenimientoPlanificado-V1.doc" style="background-image:url('/arco/Menu/images/web.png;');" class="nothing"><ins class="jstree-icon"> </ins>
Mantenimiento planificado
</a>
</li>
<li id="1227_1229" class="leaf"><ins class="jstree-icon"> </ins>
<a href="/arco/formatos/FO-0002 FormatoAnalisisRequisitos.doc" style="background-image:url('/arco/Menu/images/web.png;');" class="nothing"><ins class="jstree-icon"> </ins>
Análisis de requisitos
</a>
</li>
<li id="1227_1230" class="leaf jstree-leaf"><ins class="jstree-icon"> </ins>
<a href="/arco/formatos/FO-0003 FormatoInstructivoInstalacion.doc" style="background-image:url('/arco/Menu/images/web.png;');" class="nothing"><ins class="jstree-icon"> </ins>
Instructivo de instalación
</a>
</li>
<li id="1227_1231" class="leaf jstree-leaf"><ins class="jstree-icon"> </ins>
<a href="/arco/formatos/FO-0004 FormatoControlCalidadConstruccion.doc" style="background-image:url('/arco/Menu/images/web.png;');" class="nothing"><ins class="jstree-icon"> </ins>
Control de calidad
</a>
</li>
<li id="1227_1232" class="leaf jstree-leaf"><ins class="jstree-icon"> </ins>
<a href="/arco/formatos/FO-0005 FormatoPruebasUsuario.doc" style="background-image:url('/arco/Menu/images/web.png;');" class="nothing"><ins class="jstree-icon"> </ins>
Pruebas de usuario
</a>
</li>
<li id="1227_1233" class="leaf jstree-leaf"><ins class="jstree-icon"> </ins>
<a href="/arco/formatos/FO-0007 FormatoActas-V1.doc" style="background-image:url('/arco/Menu/images/web.png;');" class="nothing"><ins class="jstree-icon"> </ins>
Actas
</a>
</li>
<li id="1227_1263" class="leaf jstree-last jstree-leaf"><ins class="jstree-icon"> </ins>
<a href="/arco/formatos/FO-0006 FormatoSolicitudSoporte V1.doc" style="background-image:url('/arco/Menu/images/web.png;');" class="nothing"><ins class="jstree-icon"> </ins>
Solicitud de soporte
</a>
</li></ul>
这就是我构建树的方式;ajax 调用接收一个 html 列表:
$(function () {
$("#arbolMenu").jstree({
"plugins" : [ "themes", "html_data", "cookies"],
"html_data" : {
"ajax" : {
"url" : "/arco/CtrlMenu",
"data" : function (n) {
return { id : n.attr ? n.attr("id") : -1 };
}
}
}
});
}).delegate(".jstree-open>a", "click.jstree", function(event){
$.jstree._reference(this).close_node(this, false, false);
}).delegate(".jstree-closed>a", "click.jstree", function(event){
$.jstree._reference(this).open_node(this, false, false);
});