Setup default settings
Setup default settings
Vilhelm Persson
Posts: 11Questions: 0Answers: 0
Hi
I use DataTables on several pages and want to setup some default configuration that is used on all pages.
I have tried setup the dataTableSettings in a global include file but I am not able to get it to work
[code]$.fn.dataTableSettings = ( {"bPaginate":true,"bFilter": true,"bSort": true,"iDisplayLength":10,"sPaginationType": "full_numbers"} );[/code]
And then on the page do
[code]$('#ID_myTable').dataTable( {
"aaSorting": [[ 0, "asc" ]],
"iDisplayLength":25
});[/code]
But I am not able to get it to work and dont know if
- it is that I am doing something wrong in the code?
- seting wrong default parameter (dataTableSettings)?
- if is not possible?
I guess I can change my code to something
* Setup my own global settings structure.
* Setup local settings
* Use jQuery.extend
* Pass the extended object into the dataTable()
But that dont see to be the "right" way to solve it.
Best regards
Vilhelm Persson
I use DataTables on several pages and want to setup some default configuration that is used on all pages.
I have tried setup the dataTableSettings in a global include file but I am not able to get it to work
[code]$.fn.dataTableSettings = ( {"bPaginate":true,"bFilter": true,"bSort": true,"iDisplayLength":10,"sPaginationType": "full_numbers"} );[/code]
And then on the page do
[code]$('#ID_myTable').dataTable( {
"aaSorting": [[ 0, "asc" ]],
"iDisplayLength":25
});[/code]
But I am not able to get it to work and dont know if
- it is that I am doing something wrong in the code?
- seting wrong default parameter (dataTableSettings)?
- if is not possible?
I guess I can change my code to something
* Setup my own global settings structure.
* Setup local settings
* Use jQuery.extend
* Pass the extended object into the dataTable()
But that dont see to be the "right" way to solve it.
Best regards
Vilhelm Persson
This discussion has been closed.
Replies
Allan
http://datatables.net/new/1.9
http://datatables.net/release-datatables/examples/advanced_init/defaults.html
Allan