Additional script doesn't work on paginated tables from table page 2 onwards
Additional script doesn't work on paginated tables from table page 2 onwards
Hello
I use data tables to paginate and filter addresses that are displayed as table rows.
In addition I also use an script to obfuscate email addresses in this list.
Both of these scripts are called from the bottom of the page, the latter one as the last script just before the </body> tag.
My problem: the email obfuscating script only works on the first page of the paginated table. From page 2 onwards, email addresses appear obfuscated and are no more resolved by this script.
I have tried to call the email obfuscating script with drawCallback, but this resulted in the table not being paginated at all.
These are the options settings:
$("#myTable").DataTable( {
paging: true,
lengthChange: false,
pageLength: 5,
pagingType: "simple_numbers",
info: false,
responsive: true,
language: {
search: "_INPUT_",
zeroRecords: "Ihre Suche ergab kein Resultat<br>Votre recherche n'a pas reçu des resultats",
searchPlaceholder: "Tabelle filtern nach … / filtrer le tableau pour …",
paginate: {
previous: '‹',
next: '›'
},
aria: {
paginate: {
previous: 'Previous',
next: 'Next'
}
}
}
});
Thanks for your help.
Answers
Not sure what is in your code but could the second FAQ here be your issue?
Kevin
Thanks Kevin for your answer.
I am not sure, whether this answers my question. I frankly don't exactly understand what I should do with this jQuery "on" method. I am no specialist for javascript by far.
But I don't think that this script to resolve the email addresses has anything to do with events attached to table cells. It simply looks for obfuscated email addresses anywhere in the html and resolves them.
This is the code of this script:
You can see it in action here.
Note that on the first table page, emails are resolved, whereas on any other table page they remain obfuscated.
I think it would be best to put the script into
drawCallback
. If you add rows to the table the script might not affect the new rows. If the pagination is broken when usingdrawCallback
then you are probably getting a Javascript error which can be seen on the browsers console.See if this works:
Kevin
Great!!
Thank you very much, Kevin. Everything is fine now.
Pagination was broken the first time because of a missing comma.
Jörg