简体   繁体   English

jstree客户端在demang上的设置图像(无类型插件)

[英]Settings image on demang for jstree client side (without types plugin)

I want to set the image based on leaf title ie if the title of the leaf is test.html I want the image url to be set to img/html.png . 我想基于叶子标题设置图像,即如果叶子的标题是test.html我希望将图像URL设置为img/html.png

I want it to be a client-side manipulation only. 我希望它仅是客户端操作。

My question is if there is an event to hook up to before the data is loaded or modified to the tree so I can modify the image url when the node is loading or being updated? 我的问题是在将数据加载或修改到树之前是否有一个事件要挂接到,以便在节点加载或更新时可以修改图像url?

Figured it out (always shortly after asking here for some reason): 弄清楚了(总是出于某种原因在这里询问后不久):

$('#file_tree').jstree().bind('model.jstree', function (event, obj) {
    var _tree = return $('#file_tree').jstree(true);

    for (var i = 0; i < obj.nodes.length; i++) {
        var _node = _tree.get_node(id)
        _node.icon = "whatever_icon_path_i_want.png";
    }
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 jstree不兼容的复选框和类型插件 - jstree incompatible checkbox and types plugin jstree 类型插件不显示自定义图标 - jstree types plugin does not display custom icons JsTree:使用“类型”插件更改文件夹的“打开”图标 - JsTree: changing the “open” icon for folders using the “types” plugin jsTree v 3+:如何在制作jsTree时使用JSON格式传递“类型”插件的[类型]信息? - jsTree v 3+ : How to pass [Type] information for the 'Types' plugin using the JSON format in making a jsTree? JsTree的节点未使用IE中Types插件中指定的图标 - JsTree's nodes are not using using icons specified in Types plugin in IE 调整图片客户端大小 - Resize image client side 客户端图像处理 - image processing in client side 有没有一种更快的方法来查找客户端和服务器端的所有图像,音频和视频文件类型 - Is there a quicker way to look up all image, audio and video file types in both client and server side 有没有办法在所有浏览器上播放mkv视频而不在客户端安装任何插件? - Is there any way to play mkv video on all browsers without any plugin installed on client side? 在客户端裁剪和上传图像而不涉及服务器端代码 - Crop and upload image on client-side without server-side code involve
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM