That's the error I'm getting, according to Chrome's console.
The view code is pretty simple:
<script>
var table;
$(document).ready(function(){
table = $('#tableXactions').DataTable( {
"data": {{=results}} ,
"columns": [
/* { data: 'xaction.PostDate'}, */
{ data: 'xaction.Id' },
{ data: 'xaction.Amount' },
{ data: 'xaction.Expense' },
{ data: 'xaction.Tag' }
]
});
});
</script>
<table id="tableXactions" >
<thead>
<tr>
<th>Id</th>
<th>Amount</th>
<th>Expense</th>
<th>Tag</th>
</tr>
</thead>
<tbody></tbody>
</table>
The console shows that jquery.dataTables.min.js (and the css) is loaded from the datatables.net cdn (1.10.19, not the latest but close). Both my debug code and the console show that my results are as expected, so I don't think the controller is where I messed up.
The actual console message is
listing:96 Uncaught TypeError: $(...).DataTable is not a function
at HTMLDocument.<anonymous> (listing:96)
at i (jquery.js:2)
at Object.fireWith [as resolveWith] (jquery.js:2)
at Function.ready (jquery.js:2)
at HTMLDocument.K (jquery.js:2)
(listing is my view/default/listing.html)
I get this error even if I have no options in the DataTable() call. (And I should be using DataTable(), not the dataTable() version, right? Equivalent, but different return types....)
I have Roger's example, but it's much more complex than I'm ready for. The sample on
web2pyslices.com is about right, but uses a much older version. The examples on
datatables.net are snippets that they assume you know where to put them.
What's the fix for my mistake (or at least, what's my mistake?)
/dps