How to repopulate DataTables when having lots of data?

Posted by chobo2 on Stack Overflow See other posts from Stack Overflow or by chobo2
Published on 2010-05-17T23:04:41Z Indexed on 2010/05/17 23:10 UTC
Read the original article Hit count: 221

Hi

I am using datatables jquery plugin. I now have to clear the entire datatable and populate it with new data on the fly(all done through ajax).

So what I was thinking to do is when I need to do this.

  1. Destroy the datatable
  2. remove the data html
  3. call up the partial view that renders the table
  4. Rebind the datatable with jquery.

However it seems that datatable has no destroy method. So I know you can set the datatable to do something with ajax but I am not sure how. My datatable just uses the dom way when the page is loaded.

I don't want to use the "fnAddData" as I am not sure how to format this 2d array they want and I don't think this is the best option.

I think the best option is some how render the partial view back and use there ajax plugin. But I am not sure where that is or how to use it(I know it exists but that's about it).

Thanks

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about jquery-plugins