How to update values across pages with server-side processing

How to update values across pages with server-side processing

sek001sek001 Posts: 11Questions: 4Answers: 0

I have a table with two columns, "name" and "class". The table is rendered by server-side processing and has multiple pages. I have an Ajax function that allows the user to select multiple rows and change their "class" values to a particular string. When the server responds to the user's action, it sends back the ids of the rows that should be changed on the front end. Currently, I am updating the table with the following code:

    $.each(row_ids, function(i) { 
        id = "#"+row_ids[i];
        $(id).find('td:eq(2)').text(value);
    });

This works for the page I am on, but the table is not updated for any rows I have selected on subsequent pages, even though their ids are in the server response. As a result, if I go to the next page, the rows that I have selected still have the old class value. Refreshing the page in the browser shows the correct (changed) value, so it's definitely changed on the server. I do call draw() a few lines after the code above, but that does not seem to affect the results. It looks to me like the new page is being drawn from cached values, but I can't seem to figure out a way of clearing the cache that fits my use case.

Does anyone have any suggestions about how to update the table beyond the current page?

Answers

  • sek001sek001 Posts: 11Questions: 4Answers: 0

    Update: as a hack, placing window.location.reload(); at the end of my Ajax request solves the the problem. The changed values display correctly across all pages. However, I am still interested in suggestions for how to achieve this effect without reloading the entire DOM.

This discussion has been closed.