Jim?  Other datatable gurus?

/dps


On Thursday, December 2, 2021 at 4:30:20 AM UTC-8 Dave S wrote:

> 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
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/69bebf83-c0c3-42ff-ad2b-977965a932afn%40googlegroups.com.

Reply via email to