Jquery Datatable does not work

Asked

Viewed 295 times

2

I created a table on my system using the jquery datatable library, but it is not working. At the end of the view I made the code declaration in javascript, but the style is not applied.

Follows code below:

<script type="text/javascript">
    $(document).ready(function () {
     $('.table').dataTable({
            "order": [[1, "asc"]]
        });
    });
</script>

And css:

<link href="@Url.Content("~/content/DataTables/css/datatables.bootstrap.css")" rel="stylesheet" />

Note: Use 3 datatables, only one does not work and the code is identical for the 3 cases.

  • "$('.table')" Is there really such a class table? Or are you trying to manipulate the table? If so, switch to $('table')

1 answer

1

The error may be in the table html. If it is not correct (table,thead,tbody) may happen to not initialize properly.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.