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

Datatables in Blazor: Dispose() doesn't work

$
0
0

Following a post on DataTables.net, successfully I added DataTables.net on my Blazor WebAssembly across the application. The problem I'm facing is when I change page. As you can see in the following image, for each page with DataTables.net I change, I still have the search bar from the previous page.

In the code of each page I added

public void Dispose()
{
    JSRuntime.InvokeAsync<bool>("DataTablesRemove", "#tableData");
}

DataTablesRemove is defined in the index.html

function DataTablesRemove(table) {
    $(document).ready(function () {
        $(table).DataTable().destroy();
        // Removes the datatable wrapper from the dom.
        var elem = document.querySelector(table + '_wrapper');
        elem.parentNode.removeChild(elem);
    });
}

How can I fix this issue?


Viewing all articles
Browse latest Browse all 82271

Trending Articles



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