I’m trying to work with the jQuery Datatables plugin. It has everything I want, except there isn’t any flexibility with how one shows the aLengthMenu variables. It displays it in a <select> dropdown which is fine, but I have a design that isn’t flexible and wants the variables as just links.
This is how it currently displays with:
"aLengthMenu": [[5, 15, 30, 60, -1], [5, 15, 30, 60, "All"]]

I would love for it to just display links like this so one can just click a link and it would show the amount specified like this:

I know I’m messing with the core of the Datatables plugin and more specifically the _fnFeatureHtmlLength function but it would be so awesome if I could get some help on this.
There is no easy way to do this without opening up the jquery.dataTables.js file and editing it.
Yes, you are correct… you will have to edit the ‘_fnFeatureHtmlLength’ function.
I am working with jquery.dataTables.js version 1.9.1
Goto the ‘_fnFeatureHtmlLength’ function (do a search in the file for ‘function _fnFeatureHtmlLength(oSettings)’ and you should find it, mines on line 2296)
Since you are editing this file I’d make a backup first. Also, comment out the lines you are replacing so you can always refer back to them.
EDITS
Also I made changes to the datatables.css file:
But you can style it however. Also in the click event in the function I edited you maybe want to add a ‘active’ class to the selected ‘a’ tag and style however you want. Just remember to remove the active class from all other ‘a’.
I have not fully tested these changes, and since I did not write datatables I don’t know if these changes will have any side effects. Also I did not test with any plug-ins… so use at your own risk!