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 {
            if(currentTableRow == NULL) {
                return (new List<currentTableRow>());
            return currentTableRow;
        set {
            currentTableRow = value;
     *more variables and functions
    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:

        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"

1 Answer 1


If you want to continue to use your Apex controller logic that provides the data to build the dependent table, then using apex:actionFunction so that the view state is transferred is probably the way to go. (Example here apex:actionFunction with apex:param Param not setting.) You'll need to re-render that part of the page too. If what you want to pass to the server is complicated, then serializing into a JSON string might be the way to go with the Apex code deserializing via the JSON class.

Having got into a tangle mixing client-side and server-side processing myself, where possible I now stick to one or the other. Also any interaction that involves the transfer of view state is so sluggish that users get confused and end up making extra clicks because they are not seeing timely feedback. So in an ideal world I would suggest moving to building the "another table" at the client-side based on JSON data returned. But you may be relying on Visualforce table features that make that hard to do.

  • Yep JSON is the way IF this functionality stays in the view state. Probably better to move to the client side with angular/react or some such but requires more technical knowledge.
    – Adrian Larson
    Jun 3, 2015 at 19:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .