[英]"Break" Table whit css if possible
I have table that is dynamically created by pulling data from SQL DB with VBscript and then forwarded to HTML with AJAX and JQuery.我有一个表,它是通过使用 VBscript 从 SQL DB 中提取数据然后使用 AJAX 和 JQuery 转发到 HTML 来动态创建的。
This is how my HTML looks:这是我的 HTML 的外观:
<table width="100%" style="border-collapse: collapse;">
<tr bgcolor="#FF9933" >
<td width="50%" style="border-right:solid 1px black">TD 1</td>
<td width="50%">TD 2</td>
</tr>
</table>
<table id="UpdatePanel" width="100%" style="border-collapse: collapse;">
</table>
Table with id "UpdatePanel" is filled with Data that is dynamically pulled whit ajax. id 为“UpdatePanel”的表充满了动态拉取的 ajax 数据。
The tables: This is how my table looks and how the data is shown表格:这是我的表格的外观以及数据的显示方式
This is how i want it to look, i want to "break" it after lets say 26-27 rows这就是我想要的样子,我想在说 26-27 行之后“打破”它
I don't know if you can accomplish this just with CSS or CSS and JQuery or with something else.我不知道您是否可以仅使用 CSS 或 CSS 和 JQuery 或其他东西来完成此操作。
This isn't something CSS can do, cleanly at least.这不是 CSS 可以做到的,至少是干净的。 I recommend splitting the data after ajax success and creating multiple tables.我建议在 ajax 成功后拆分数据并创建多个表。
function createTables(data){
var $tr = $(data)
var size = 26;
while($tr.length > 0){
var table = $('<table></table>').append($tr.splice(0,size))
$('body').append(table)
}
}
And then float:left
or display:inline-block
on your tables.然后float:left
或display:inline-block
在你的桌子上。
example: https://jsfiddle.net/guanzo/rw59c65b/示例: https : //jsfiddle.net/guanzo/rw59c65b/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.