Hi all,
I’m taking the first steps on yii framework.
I’m trying to use DataTables on yii but i’m facing this issue:
[color="#FF0000"]Uncaught TypeError: $(…).DataTable is not a function
at HTMLDocument.<anonymous> (table_page:65)
at c (jquery.min.js:4)
at Object.fireWith [as resolveWith] (jquery.min.js:4)
at Function.ready (jquery.min.js:4)
at HTMLDocument.q (jquery.min.js:4)[/color]
The CODE i’m using:
<HTML>
<HEAD>
<TITLE>My first HTML document</TITLE>
<link rel="stylesheet" type="text/css" href=".../1.10.13/css/jquery.dataTables.min.css">
<script type="text/javascript" language="javascript" src=".../jquery-1.12.4.js"></script>
<script type="text/javascript" language="javascript" src=".../1.10.13/js/jquery.dataTables.min.js"></script>
<script type="text/javascript" class="init">
$(document).ready(function() {
var table = $('#example').DataTable();
$('#example tbody').on('click', 'tr', function () {
var data = table.row( this ).data();
alert( 'You clicked on '+data[0]+'\'s row' );
} );
} );
</script>
</HEAD>
<BODY>
<table id="example" class="display" cellspacing="0" width="100%">
<thead>
<tr>
<th>Name</th>
<th>Position</th>
(…)
When i use this code outside Yii this is working properly.
Anyone can help me?
Thanks in advance!