TypeError: jQuery (...). DataTable is not a function in Grails

I am trying to install jquery datatable on grails 2.1 with no luck so far. I installed jquery, jquery-ui and jquery-datatable plugins. The following code has been added to main.gsp:

<g:javascript library="jquery" plugin="jquery" /> <r:require module="application"/> <jqui:resources /> 

and this code for my view:

  <jqDT:resources /> <g:javascript> $(document).ready(function() { jQuery('#demo').dataTable({ sScrollY: '70%', bProcessing: true, bServerSide: true, sAjaxSource: '${request.contextPath + '/person/dataTablesData'}' , sPaginationType: "full_numbers", aLengthMenu: [[100, 500, 1000, 5000, -1], [100, 500, 1000, 5000, "All"]], iDisplayLength: 500 }); }); </g:javascript> 

but when I tried to do this, I got the following exception:

 TypeError: jQuery(...).dataTable is not a function 

How can i solve this?

+4
source share
1 answer

Just a guess, but it may be that you are using jQuery 2, which removes / replaces some functions from previous versions. Try jQuery 1.10.1 and see if there are any improvements.

0
source

All Articles