I am creating a mobile optimized website that is dynamically created by recognizing a request from a mobile device, manipulating the existing page to be mobile optimized using php and the html parser, QueryPath. Some of the pages I plan to manipulate contain html tables, such as this one, which to don't display well on mobile.
I am looking for a function that can handle any html table of any amount of rows and columns and manipulate it so it will show up well formatted on a mobile device. I am using the jquery mobile framework.
a solution in either php or javascript/jquery would be great.
Here is a jsFiddle of what I mean: Link
I have used this responsive table approach from Filament - responsive tables, demo and turned it into an Jquery Mobile "extension" called tableview - see here.
To use it, you only need to specifiy inside the HTML markup, which columns are most, more, less important, plus add the respective JQM triggers and the extension handles the rest. Depending on screen size, priority columns are shown, while the other columns are hidden.
I changed the "display" button and menu from the original example to a JQM custom select, with which you can toggle cols as you need, added a filter (same as JQM listview), sortable headers (only embedded buttons, no functionality), dynamic checkboxes, highlighting and some other stuff.
The extension is not finished and does not contain any logic (sorting, pagination etc), except for the filter.
I'm also working on a datatables.net version of tableview. Let me know, if you need a working example of this. More or less done as well.