0

I have an XWiki page, where I would like to include a jsTree object. The jsTree macro is loaded into the XWiki, and is is usable on the pages.

I have some nodes like:

* root 1
* root 2
** subnode text 1
** subnode text 2

Until this, it is working fine, and the jsTree shows the correct view.

I would like to have more links on the subnodes like:

** <a href="link1">subnode</a> <a href="">text 1</a>

With wiki code:

** {{box}}[[subnode>>TestPageFirst]] [[text>>TestPageSecond]]{{/box}}

I have also tested the span tag with onClick event, but that is also removed by jsTree.

** {{html}}<span onClick="location.href='[[TestPageFirst]]';">Subnode</span> <span onClick="location.href='[[TestPageSecond]]';">text 1</span>{{/html}}

My problem is that the jsTree script replaces the links from my text, and uses '#' instead of mine. How could I create more links on the nodes?

pega
  • 23
  • 3
  • Are you trying to add multiple links in a single node? – Varvarigos Emmanouil Feb 05 '18 at 16:22
  • Yes, this is what I would like to do. – pega Feb 06 '18 at 15:26
  • After some research (jstree API and google) I found about the types plugin. Check here: https://stackoverflow.com/questions/4899520/jstree-types-plugin-does-not-display-custom-icons – Varvarigos Emmanouil Feb 06 '18 at 16:42
  • I think this types plugin is not what I'm searching for. With this plugin you can add eg. an icon, but only one type for each node. What I have found is if I would have only one link at a node, I could use `$('#jstree').on("click", ".jstree-anchor", function () { document.location = $(this).attr("href"); })` but this is only working for one link. In my case I would need several. – pega Feb 06 '18 at 23:16
  • For one link you can use the a_attr property also. But I haven't found something that could solve your problem for multiple links. I would consider switching the library if the use of jstree is not mandatory :) – Varvarigos Emmanouil Feb 07 '18 at 08:45
  • Unfortunately this is what I suspect. But maybe someone knows the magic :) – pega Feb 08 '18 at 09:54

0 Answers0