html table行列反转,如何反轉(轉置)HTML表的行和列? - How to invert (transpose) the rows and columns of an HTML table?...

5

What language do you want to do it in? I assume JavaScript, as you said jQuery. (jQuery is not a language, it's library to a language)

你想用什么語言做?我假設是JavaScript,就像你說的jQuery。(jQuery不是一種語言,它是一種語言的庫)

You need to find a way to represent the table as a data structure. This should be done via OOP for simplicity. I recommend you to get the number of columns and rows and put the data in 1 single, flat array.

您需要找到一種將表表示為數據結構的方法。為了簡單起見,應該通過OOP來完成。我建議您獲取列和行數,並將數據放在一個單一的平面數組中。

You also need to design something that will parses through the HTML and gets the table, converting it to your structure, allowing computations to be done easily. This can be done via jQuery's method.

您還需要設計一些可以通過HTML解析並獲取表的東西,並將其轉換為您的結構,以便輕松地完成計算。這可以通過jQuery的方法實現。

Then you need to find a sort function that sorts the flat array.

然后需要找到排序函數來排序平面數組。

Lastly, you need to break up the the array into the appropriate columns and rows and rerender the HTML.

最后,需要將數組分解為適當的列和行,並重新運行HTML。

See! Not that difficult. Designing is pretty much done for you, all you need is to implement it. (Maybe i shouldn't do so much work for you..)

看!沒有那么困難。設計基本上已經為您完成了,您所需要的就是實現它。(也許我不應該為你做那么多工作。)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值