knewlife

DataTable custom implementation

knewlife
4 months ago
Hi, i'm using Smarty 5 in a new project on my job. We have to use datatable with ajax and many custom configurations.
I'm also usin AJAX navigation and have some problems using multiple datatables and extending the configuration using this method from the documentation:

https://smarty.stepofweb.com/5.0.6/html_frontend/documentation/plugins-vendor-datatable.html

Using javascript to extend/overwrite current Smarty config:
(this example will hide pagination and searching)

<script>
var dataTableExtend = {
paging: false,
searching: false,
};
</script>

So i want to try creating a custom datatable manualy with javascript. In the documentation i can find this:

You can create your own datatable by passing this attribute: data-custom="true"
From this point, you handle the entire script - plugin is loaded as long you keep .table-datatable class!

But how exactly i can do that? can't find examples, if i try to do it normally i get an error about DataTable not being defined:

let table = new DataTable('#myTable');

thanks in advance.

Last edited 4 months ago