Hi!
-
In edit mode: using the JSX and AJAX I pass the selected JSTree nodes to the page:
require([‘jquery’, “$!services.webjars.url(‘org.xwiki.platform:xwiki-platform-tree-webjar’, ‘require-config.min.js’, {‘evaluate’: true})”], function($) {
var hdwType = “$escapetool.javascript($request.getParameter(‘prmHdwType’))”;
require([‘tree’], function($) {
$(’.xtree’).on(“changed.jstree”, function (e, data) {
var i, j, treeSelectedValue = [];
for(i = 0, j = data.selected.length; i < j; i++) {
var selId = data.instance.get_node(data.selected[i]).id ;
var selText = data.instance.get_node(data.selected[i]).text;
var SetItem = $(this).map(function() {return selId + “:” + selText}).get().join();
treeSelectedValue.push(SetItem);
};
sendTreeSelectedValue(treeSelectedValue);
});function sendTreeSelectedValue(value) {
var docUrl = “$escapetool.javascript($request.getParameter(‘prmDoc’))”;
var UrlParams = {‘xpage’: ‘plain’,‘outputSyntax’: ‘plain’, ‘hdwTypeValue’: JSON.stringify(value)};
new Ajax.Request(docUrl, {
parameters: UrlParams,
onSuccess : function(response) {}
});
}
});
}); -
On the page I receive the data from the request as map:
$doc.set(‘hdwType’, $request.getParameterMap(“hdwTypeValue”))
$doc.save() -
In view mode I want to display data as a list / table:
#set ($valStrProc = {})
#set ($empty = $valStrProc.put($value.replace(’"’,’’).replace(’[’,’{’).replace(’]’,’}’)))
#foreach($item in $valStrProc.entrySet())
|$item.key|$item.value|
#end
But code from p.3 does not work.
Where am i wrong? How to do it correct?
Thanks…