Manually calling a server action
Please note this code needs to be tested in more use cases, it will require an effort from you to understand and use it. Please send us feedback about your success or fixes.
Suppose you want to call a server action from your code. This can be done this way:
var oper = new kukit.op.Oper();To explain this a bit: you need to create a new oper first:
oper.parms.myParm = "xxx";
oper.executeServerAction("theServerActionsName");
var oper = new kukit.op.Oper();
The oper object is used in kss to make the javascript call signature of the handlers simpler. This is handy since in javascript there is no possibility to use keyword parameters in function calls. Oper is similar to a dictionary thet contains a set of variables, but it also contains some commodity methods to handle these variables.
If you are already in kss code, you need not do to create oper, but you can use the oper already provided at that place.
Next you set the parameters on oper as you like. You can set more parameters. Remember, you must use strings in every case.
oper.parms.myParm = "xxx";
oper.parms.secondParm = "yyy";
Following this, you are ready to call the desired remote action on the server:
oper.executeServerAction("theServerActionsName");
This will happen asynchronously, so control returns to your code immediately, and the result of the server action will be handled later by KSS.