Hi,
Yes there is. You can pass any kind of parameters to a custom action and obtain a result.
Let's have a look on the PostCustomServerAction prototype:
Code: Select all
PostCustomServerAction: function (docuViewareID, async, actionName, params, success, error)
The interesting part for you is the success trigger.
Here an example based on our barcode recognition demo, that will show in client side the result obtained from the server action:
Code: Select all
function onBarcodeRecognitionSuccess(result) {
alert("result: " + JSON.stringify(result));
}
function barcodeRecognition() {
var json = {
readlinear: false,
readqrcode: false,
readmicrorrcode: false,
readdatamatrix: false,
readpdf417: false
};
if ($('#chk-linear').is(":checked")) {
json.readlinear = true;
}
if ($('#chk-qr').is(":checked")) {
json.readqrcode = true;
}
if ($('#chk-microqr').is(":checked")) {
json.readmicrorrcode = true;
}
if ($('#chk-datamatrix').is(":checked")) {
json.readdatamatrix = true;
}
if ($('#chk-pdf417').is(":checked")) {
json.readpdf417 = true;
}
DocuViewareAPI.PostCustomServerAction('DocuVieware1', true, "barcodeRecognition", json, onBarcodeRecognitionSuccess);
}
As you can see we are getting a result object, as parameter of the success trigger.
This object result is obtained from the server side. You can assign it during the CustomActionsHandler event. IE:
Code: Select all
private void CustomActionsHandler(object sender, CustomActionEventArgs e)
{
e.result = new object();
}
I can imagine this is not super clear, so please Peter, let me know if you need any further information.
Cheers,
Loïc