Different sorts on different tables when called from an external JS file
Different sorts on different tables when called from an external JS file
dowzer
Posts: 11Questions: 3Answers: 0
I am using Datatables 1.8.2 and it works so well with one small problem.
My Datatables initialisation is done in an external JS file which is then called from a template file so all pages have the code included without needing to manually add it.
The problem I have is not all my tables are the same - for example, in table 1 on page 1 I could have date in the first column and then on table 1 on page 2 I could have name in the first column and the preferred sort order of these is different with one desc and one asc.
Using my configuration, how can I accommodate this? Ideally I would like to be able to create more than one Datatable definition so I could have DT_date_col0_desc which is for tables with a date in column zero and sorted desc and then DT_text_col0_asc which is for a table with text in column zero sorted asc.
Does that make sense? As the application is now extensive I cannot easily go back to every page and manually add the custom Datatables initialisation to each page so an looking for alternate methods if possible.
Thanks
Jase
My Datatables initialisation is done in an external JS file which is then called from a template file so all pages have the code included without needing to manually add it.
The problem I have is not all my tables are the same - for example, in table 1 on page 1 I could have date in the first column and then on table 1 on page 2 I could have name in the first column and the preferred sort order of these is different with one desc and one asc.
Using my configuration, how can I accommodate this? Ideally I would like to be able to create more than one Datatable definition so I could have DT_date_col0_desc which is for tables with a date in column zero and sorted desc and then DT_text_col0_asc which is for a table with text in column zero sorted asc.
Does that make sense? As the application is now extensive I cannot easily go back to every page and manually add the custom Datatables initialisation to each page so an looking for alternate methods if possible.
Thanks
Jase
This discussion has been closed.