Quantcast
Viewing all articles
Browse latest Browse all 82110

Problem initializing dataTable

Hello, i've been trying to use datatable but without any success so far. I get the following error:

TypeError: $(...).dataTable is not a function
$('#index-table').dataTable(); Post (line 569)
fire(data=[Document Post, [function()]])jquery-1.9.1.js (line 1037)
fireWith(context=Document Post, args=[Document Post, [function()]])jquery-1.9.1.js (line 1148)
ready(wait=undefined)jquery-1.9.1.js (line 433)
completed(event=DOMContentLoaded )jquery-1.9.1.js (line 103)

I'm working on asp.net mvc, jQuery 1.9.1 and dataTables 1.9.4 the page is the following (minus content and Razor code):

<table class="index-table" id="index-table">
    <tr>
        <th>
            test
        </th>
        <th>
            test
        </th>
        <th>
            <span>Status</span>
        </th>
    </tr>
</table>

@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/jqueryui")
@Scripts.Render("~/bundles/datatable")

<script type="text/ecmascript">
    $(document).ready(function () {
        $('#index-table').dataTable();
    });
</script>

First, I tried to install the plugin manually and I found that the nuget jquery package (1.7.x) was overriding the import I was using from a more recent version. I updated the nuget packages and installed this plugin from the nuget repository also, and that part was resolved but I still get this error. I imported jqueryui just in case (since I saw some posts mentioning it and thought it was required), but it didn't fix anything

Can someone help me? I know that it must be something silly but it escapes me right now

Thanks in advance

Viewing all articles
Browse latest Browse all 82110

Trending Articles



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