Recently, I've set up a grid view for some content using an unordered list to create a visually appealing block layout. Now, I've been given the task of presenting the same data in a table format. The data also involves various actions that can be performed on it. While the visual switch is intended for shorter lists, there could be longer lists as well.
I'm considering reusing the existing structure of the unordered list and enhancing it with additional elements to simulate a table view, which doesn't seem too difficult. Another option is to redo everything in a table format and then use CSS to implement the grid view.
My main query is regarding the approaches to tackle this challenge. One thought is to duplicate my markup - implementing both views and toggling between them. However, in an AJAX-intensive application, this would mean performing double the DOM manipulations to incorporate these changes.
Is there a recommended practice for seamlessly switching between views like this? I'm eager to hear about various ideas and practical examples from those who have worked on similar projects.
To illustrate further, I've included a jsFiddle demonstrating the use of an unordered list as the foundation. Can anyone provide sample CSS code that utilizes a table as the core structure?