Uncaught TypeError: Object [object Object] has no method 'dataTable'

Uncaught TypeError: Object [object Object] has no method 'dataTable'

rekabumeisterrekabumeister Posts: 3Questions: 0Answers: 0
edited January 2013 in DataTables 1.9
Hey,
I've been trying to use datatables in an ASP.NET page but it just doesn't seem to work. My table is the following:

[code]



First Name
Suname
Email address
Phone Number




@foreach (var member in Model)
{

@member.FirstName
@member.SurName
@member.Email
@member.PhoneNumber

}





[/code]

And my javascript section looks like this:
[code]


$(document).ready(function () {
$('#searchMembers').dataTable();
});

[/code]
When I load the page I get the following error:

Uncaught TypeError: Object [object Object] has no method 'dataTable' SearchMembers:1283
(anonymous function) SearchMembers:1283
fire jquery-1.8.3.js:974
self.fireWith jquery-1.8.3.js:1084
jQuery.extend.ready jquery-1.8.3.js:406
DOMContentLoaded

After some searching I updated my jquery-ui to the latest (1.9.2) but it didn't help.

What am I doing wrong? I would so love to use datatables but I just can't get it working! Is it possible that I haven't copied some of the files or didn't copy them to the right place?

Thanks a lot in advance!

Replies

  • essexstephessexsteph Posts: 57Questions: 0Answers: 0
    Just looking at your posted javascript you haven't actually included the Datatables javascript jquery.dataTables.js.

    Steph
  • rekabumeisterrekabumeister Posts: 3Questions: 0Answers: 0
    Hey,
    I tried that too, but I got the same result
  • allanallan Posts: 63,389Questions: 1Answers: 10,450 Site admin
    Please link to a test case: http://datatables.net/forums/discussion/12899/post-test-cases-when-asking-for-help-please-read

    Allan
  • rekabumeisterrekabumeister Posts: 3Questions: 0Answers: 0
    Thanks, with the links in that post i managed to identify the problem:
    At the bottom of the layout page there was this:

    [code]
    @Scripts.Render("~/bundles/jquery")
    @RenderSection("scripts", required: false)
    [/code]

    These lines generated two futhe jquery inludes to the bottom of the page hence breaking things. All is solved now, thank you!
This discussion has been closed.