本文介绍了转置一个html表格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以转置一个html表格(没有javascript)。
我从一个对象列表生成一个包含rails(和erb)的表。所以当每一行对应一个对象时,做到这一点非常简单和自然。不过,我需要将每个对象都表示为一列。我想只有一个循环,并描述每一列,而不是为每一列做相同的循环。 (这不一定需要是一个真正的表格,可以是一个列表或任何可以实现的技巧)。
更新
澄清问题。我不想在ruby中转置一个数组,但要垂直显示一个html表格。我的实际表格实际上是使用每行一个部分,生成一个单元格列表(td)。如果有帮助,这可以更改为列表。无论如何,这是HTML问题不是一个红宝石问题:如何显示垂直行(而不是水平)行的表。 解决方案
显然,答案是否定的: - (
Is it possible to transpose an html table (without javascript).I m generating a table with rails (and erb) from a list of object. So it's really easy and natural to do it when each row correspond to one object. However , I need each object to be represented as a column. I would like to have only one loop and describe each column rather than doing the same loop for every columns. (That doesn't necessarily needs to be a real table , could be a list or anything which does the trick).
update
To clarify the question. I don't want to transpose an array in ruby, but to display a html table with the row vertically. My actual table is actually using one partial per row, wich generate a list of cell (td). That can be change to a list if that help. Anyway this is HTML question not a ruby one : how to display a table with the rows vertically (rather than horizontally).
解决方案
Apparently, the answer is no :-(
这篇关于转置一个html表格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!