Fixed headers and columns
Thursday, February 5th, 2009
Recently I started creating the mock-ups for the JustRosters application. Part of this application is a calendar table that needed fixed headers and columns, with scrollable content area to fit in a restricted space. This concept can be seen in programs like in Microsoft Excel or similar spreadsheet programs, how the row and column numbers remain along the top and side at all times. After a bit of research, we found out that this hasn’t been done in HTML / CSS before, only full JavaScript applications with big budgets (like Google Spreadsheet). Since this wasn’t our case, we were after an open source solution, but this wasn’t easy to find or achieve.
After what felt like a million Google searches, we finally came across a script that would have done exactly what we wanted it to do, only to find out that it was incomplete. It had some of the features we needed, fixed header, fixed columns and scrolling of the inner data cells while remaining lined up. It just wasn’t cross browser compatible, did not support fluid width columns or row heights. I installed the script and after fixing it up for a few days, I got it to work….. sort of.
What we needed was to have the data table take up maximum width and height of the browser content area, but doing this broke the script or the cells didn’t line up. After a lot of trial and error, tweaking the JavaScript and the css, I was finally able to create a fixed header and column table with dynamic resizing based on browser window size, row count and column count. The resulting table can be viewed here for now, and will be integrated into the finished JustRosters staff scheduling application. When I get a chance I will post code snippets.


