我在第二列中使用了jsTree和jsTree Grid以及数据 [英] I am using jsTree and jsTree Grid and data in my second column disppears
问题描述
我在jsTree Grid中有一列代表我的树。第二列用于显示与每个节点相关联的标签。它显示很好,直到我点击另一个级别。
I have one column in jsTree Grid representing my tree. The second column is used for displaying "tags" associated with each node. It is displaying great until I click another level.
因此第二列将创建一个div,我的标签(类似于堆栈溢出标签)将附加到该html元素。
So the second column will create a div and my tags (similar to stack overflow tags) are appended to that html element.
这是第一次加载页面时的问题。我看到根节点就好了,与我在第二列中定义的根节点关联的标签。看起来很棒!
Here is the issue, when the page first loads. I see the root node just fine and the "tags" associated with the root node that I defined in the second column. Looks great!
当我点击展开根节点时,进入下一个级别。我丢失了与根节点关联的标签。我想要的是保留它们,但我无法弄清楚为什么网格会丢失它。
When I click to expand the root node, to get to the next level. I lose the tags associated with the root node. What I want is to keep them but I can't figure out why the grid is losing it.
编辑:
删除了代码和图片。
推荐答案
问题是,当您展开节点时,jsTreeGrid插件会重绘单元格。由于您只在已加载和select_cell事件期间附加标记,因此标记会消失。
The problem is that the jsTreeGrid plugin redraws the cells when you expand a node. Since you only append your tags during the "loaded" and "select_cell" events, the tags disappear.
您可以通过在更多事件上重新附加标记来解决此问题:
You can workaround this by re-appending the tags on more events:
.bind("open_node.jstree create_node.jstree clean_node.jstree change_node.jstree", function (event, data) {
doDisplayTags(mapNameTag);
})
这篇关于我在第二列中使用了jsTree和jsTree Grid以及数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!