change data table attributes to function
change data table attributes to function
spinx
Posts: 3Questions: 1Answers: 0
hi,
I'm new with datatable, i want to create a global datatable function and use the attribute like 'paging' 'order' 'language' each of them as function declared in a config file which contain the global datatable function to allow me to not repeat many declaration everytime in the project is that possible and how please i'm stuck since 3 days.
This discussion has been closed.
Answers
You can create a "DT defaults" script. See here:
https://datatables.net/manual/options#Setting-defaults
thank you, but i want that ordering and select to become function cause some table are not the same as other. For example : some need ordering other no some need select checkbox other no and i want to create those select ordering etc.. as function to not write them everytime just call them like this code.
var table = $('#example').DataTable();
table.ordering();
table.select();
Most of the options need to be initialized when initializing Datatables. Some can be set or changed after initialization. Specifically is it looks like you can use
select()
this way. But there is not aordering()
API. The list of Datatables APIs is here. Each extension has their own list of APIs such as Select APIs are here.Kevin
so basically i can't change those attribute to customized function but i can use the api function only.