I have a VF page where on a click of a specific table element, it needs to update another table. I have a jquery script that does this and then calls a static function with the remoting manager. My problem is that the other table is made with an apex:repeat and it takes variables from my controller as input. However, because my function is static, I cannot save the output to the variables in the controller.
I considered using an actionFunction, but I don't think I can pass a complicated object list in as a parameter.
Here is some code to provide more context.
global class tableController {
List<TableRow> currentTableRow {
get{
if(currentTableRow == NULL) {
return (new List<currentTableRow>());
}
return currentTableRow;
}
set {
currentTableRow = value;
}
}
/*
*
*more variables and functions
*
*/
@RemoteAction
global static List<scheduleTableRow> retrieveSchedules(input variables....){
//Does stuff
return variable <--- this variable needs to be the "currentTableRow" from above
}
}
Then here's the javascript:
<script>
var scheduleTableRows[];
Visualforce.remoting.Manager.invokeAction('{!$RemoteAction.tableController.retrieveSchedules}', input variables...,
function (result, event) {
scheduleTableRows = result; <--- Need this result to be passed back into the controller for "currentTableRow"
}
);
</script>