Implementing Ajax function and sorting with datatables
Implementing Ajax function and sorting with datatables
Hello dear community,
I would like to integrate datatables in my grav page, unfortunately I’m not familiar with javascript. My code look like this:
[datatables paging=false ordering=false info=false searching=false]
|Firma|Name|Sitzungszimmer|Uhrzeit|Datum|
|—|---|
|Company1|User1|Pilatus 3.OG|13:15|23.11.2019|
|Company2|User2|Pilatus 3.OG|14:15|24.11.2019|
[dt-script]
var table = (selector).DataTable(); (selector + ’ tbody’).on( ‘click’, ‘tr’, function () {
if ( (this).hasClass('selected') ) { (this).removeClass(‘selected’);
}
else {
table.('tr.selected').removeClass('selected'); (this).addClass(‘selected’);
}
} );
[/dt-script]
[/datatables]
I tried the whole day to implement ajax and a sort function.
I read following article https://datatables.net/reference/option/ajax.dataSrc.
From the description I assumed that I can integrade it like this:
[datatables paging=false ordering=false info=false searching=false ajax:“http://*****.****.ch/BrightSign/datatables.txt”]
any Suggestions ? I tried many things but don’t get the point.
Answers
Solution was given in follow topic:
https://discourse.getgrav.org/t/implementing-ajax-function-and-sorting-with-datatables/10742/5
Sorry for the double posting, hope this will help someone out.