Answer the question
In order to leave comments, you need to log in
Creating an HTML table layout?
Hello.
I have a dataset, for each field its position in the table is written - the X and Y coordinates indicating the position of the cell in the table, as well as Rowspan and Colspan, indicating you know what. Can anyone suggest an algorithm by which I can create an HTML table with all colspans and rouspans? The size of the table in "absolute" cells and rows is known in advance, you just need to create a cell layout.
Thanks in advance.
UPD. Here's what the layout data will look like. Of course, this will not be in JSON, it just seemed to me that it would look easier this way. As a result, the following code should be transformed into a valid table, and I took it from there :)
{<br/>
row : { <br/>
cell : { x: 0, y: 0, colspan: 2, rowspan: 1}, <br/>
cell : { x: 2, y: 0, colspan: 1, rowspan: 1}<br/>
},<br/>
row : { <br/>
cell : { x: 0, y: 1, colspan: 2, rowspan: 3}, <br/>
cell : { x: 1, y: 1, colspan: 2, rowspan: 1}, <br/>
cell : { x: 2, y: 1, colspan: 2, rowspan: 2}<br/>
},<br/>
row: {<br/>
cell : { x: 1, y: 2, colspan: 1, rowspan: 1}<br/>
},<br/>
row: {<br/>
cell : { x: 1, y: 3, colspan: 1, rowspan: 1},<br/>
cell : { x: 2, y: 3, colspan: 1, rowspan: 1}<br/>
},<br/>
row: {<br/>
cell : { x: 0, y: 4, colspan: 3, rowspan: 1}<br/>
} <br/>
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question