4

I'm trying to install jquery datatable on grails 2.1 with no luck until now. I installed JQuery, JQuery-ui and jquery-datatable plugins. added the following code to main.gsp:

<g:javascript library="jquery" plugin="jquery" />

        <r:require module="application"/>
        <jqui:resources />

and this code to 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 render it I got the following exception:

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

How can I solve this?

doelleri
  • 19,232
  • 5
  • 61
  • 65
Feras Odeh
  • 9,136
  • 20
  • 77
  • 121

1 Answers1

0

Just a guess, but could be that you are using jQuery 2, which removes/replaces some functionality from previous versions. Try jQuery 1.10.1 and see if there is any improvement.

binderbound
  • 791
  • 1
  • 7
  • 27