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