Generic Table Building Function
Im having an interesting/tough problem. I need to design a generic table building function.
I need to make tables (ie rows and columns, like html tables), but I dont know how big the tables need to be, or even their exact shape, until run time. To make things worse, some of the rows will span multiple columns, and some of the columns will span multiple rows. So basically I will need a pretty generic function to do this.
Any ides? Im thinking about building a hierarchy of tables and sub-tables, all the way down to a single cell being the smallest sub-table. But I havnt worked out the details yet. Also I may have to vary the width and height of the cells (and therefore the rows/columns) depending on the data that will go into them, so I guess my solution will have to read all the data in before doing any table calculations...
Im not really sure where to start with this problem. Please feel free to brainstorm with me!
Ive done tons of tables in HTML. I have no idea how they programed them to work in browsers though.
Ive fleshed out my tree idea a little more. The root is a 'table'. Its children are all 'rows', and all children of 'rows' are 'cells'. If a row needs to have 2 sub-rows, then the 'row' has a 'cell' child, and that 'cell' has 2 'row' children.
Hard to explain without drawing a picture, but I think it makes sense so far...
Ive fleshed out my tree idea a little more. The root is a 'table'. Its children are all 'rows', and all children of 'rows' are 'cells'. If a row needs to have 2 sub-rows, then the 'row' has a 'cell' child, and that 'cell' has 2 'row' children.
Hard to explain without drawing a picture, but I think it makes sense so far...
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement