Hello!
Thanks for all the previous hints and help, unfortunately I can not fly by myself, so I ask again :
How to process the data in the resulting serviceDocument?
Thank you in advance.
Hello!
Thanks for all the previous hints and help, unfortunately I can not fly by myself, so I ask again :
How to process the data in the resulting serviceDocument?
Thank you in advance.
Hi!
Globally, I want to use Livetable with checkbox as a lookup table for displaying and setting data.
How to organize data transfer and processing in the resulting serviceDocument?
Can I redefine the serviceDocument (another space/name)?
How to set checkboxes programmatically?
Does anyone have any working examples or can advise?
Thanks.
Hi!
Describe my efforts:
var formData = {
"autputSyntax": "plain",
"cbData": [
"Alvaro",
"Brandon"
],
"xpage": "plain"
};
$.post('http://xwiki.censored.com/xwiki/bin/view/Code/ServiceDocument', formData)
.done (showResult)
.fail(showError);
{
"frameId": 0,
"initiator": "http://xwiki.censored.com",
"method": "POST",
"parentFrameId": -1,
"requestBody": {
"formData": {
"autputSyntax": [
"plain"
],
"cbData": [
"Alvaro",
"Brandon"
],
"xpage": [
"plain"
]
}
},
"requestId": "375832",
"tabId": 1612,
"timeStamp": 1549962017587.2048,
"type": "xmlhttprequest",
"url": "http://xwiki.censored.com/xwiki/bin/view/Code/ServiceDocument"
}
http://xwiki.censored.com/xwiki/bin/view/Code/ServiceDocument
JavaScriptExtension
object require(['jquery'], function ($) {
var Target = $('#checkboxService')
var Launcher = $('#GetJson')
var Url = new XWiki.Document('cbResults','DatabaseInventory').getURL('get');
var UrlParams = { 'xpage': 'plain','outputSyntax': 'plain' };
Launcher.click(function(){
$.get( Url, UrlParams, function( data ) {
$( Target )
.append( "Вибрано: " + data.cbData );
}, "json" );
});
});
What else needs to be done, for example, to display the list of selected values on the resulting page?
Thanks.
Hi!
At the moment I have been able to transfer data to ServiceDocument
and get Response
:
ServiceDocument code:
{{velocity wiki="false"}}
#set ($responseMessage = 'Slepping...')
## If AJAX call
#if("$!request.autputSyntax" != '')
$response.setContentType('application/json')
set ($responseMessage = 'Request detected')
#end
$responseMessage
{{/velocity}}
Response:
But I still do not know how to process the data in the sectionForm Data
:
Any ideas?
Thanks…
Solved:
.......................................
{{addCheckboxColumnToLivetable livetable="hdwLookUpSoftware" column="softID" buttonId="sftCheckboxService" serviceDocument=$doc /}}
.......................................
#if("$!request.autputSyntax" != '')
#set ($paramlist = '[')
#foreach ($param in $request.getParameterValues("cbData"))
#set ($paramlist = $paramlist + $param + ', ')
#end
#set ($paramlist = $paramlist + ']')
#set ($paramlist = $paramlist.replace(', ]', ']'))
$doc.set('hdwSoftware2', $paramlist)
$doc.save()
#end
Сode is ugly, but it works