column update with fnReloadAjax

column update with fnReloadAjax

csteph9csteph9 Posts: 2Questions: 0Answers: 0
edited April 2012 in General
I've been searching for a while and I can't find any specific examples or plugins that let me update the column def when doing a fnReloadAjax call.

my code successfully updates the table data ... but in my case, I may have a change of columns in the return data. For example, a user may search first name, and the table updates for first name data. Then the user adds a query term for last name, the table then should add a column to show last name.

In the JSON object returning from the server in the ajax call, I tried just redefining aoColumns as an element (at the same level as aaData), but it doesn't initialize like the rows do in the fnReloadAjax call.

Is there a way to also update aoColumns after table init?

Thanks

Replies

  • roineroine Posts: 14Questions: 0Answers: 0
    I'm also searching an answer for this problem
  • csteph9csteph9 Posts: 2Questions: 0Answers: 0
    roine, I ended up just using the google datatable API. it's very easy to implement and lets you modify many aspects of the table post init. check it out here: https://developers.google.com/chart/interactive/docs/examples
  • blastorblastor Posts: 14Questions: 0Answers: 0
    I have the same problem, i click a button and add a column in the table, but when call fnDraw() call back old column data...
  • roineroine Posts: 14Questions: 0Answers: 0
    csteph9, do you mean you don't use datatables.js?
This discussion has been closed.