Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 82282

Datatables - reload table using HTML

$
0
0

HI,

I am working on some legacy code.

Basicly how it works is first time table is generated, table content is generated like this

                    <tbody>
                        @Html.Raw(ViewBag.HTML)
                    </tbody>

ViewBag.HTML = is simply an html string returned by a controller ("<tr><td class=\" details-control2\"></td><td> ....).

Next datatable is initilized with all of its settings and some custom functions run on this table.

Now through Ajax request i'can retrive new 'html' string for tbody part, and with Jquery i replace old table content like this

$("#someTable tbody").html(response);

Data gets replaced fine, but non of the custom functions (like adding urls to some fields, or changing values to % exists anymore. I would like to be able to reintilize datatable based on its new content.

Tried couple of things but nothing really worked for me

fnDraw(); - redraws table with old values.

Running functions after new data is loaded won't work as it needs to be run during intialization.

I also need this to be reloaded without refreshing the page.

rewriting code to not return this weird html string would take a long time, so i would appriciate any tip on how can this be 'reloaded'

Best regards,


Viewing all articles
Browse latest Browse all 82282

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>