本文介绍了反转HTML网格数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个html网格表,可以在js文件中创建该表,看起来像这样
I have a html grid table which creates the table in js file and looks like this
tbl_html = tbl_html + '<tbody>' +
'<td>' + yearconvert(yearr) + '</td>' +
'<td>' + starttime+ '</td>' +
'<td>' + endtime + '</td>';
有一个循环,给出了year,starttime,endtime的值.它显示得很好,但我想反转在html grid中看到的结果.
There is a loop which gives the value of year ,starttime ,endtime . It displays it well but I want to reverse the result which I see in html grid .
for (var i = 0; i < matrix.length; i++) {
var starttime= Date.UTC(parseInt(matrix[i].start_time);
var endtime = Date.UTC(parseInt(matrix[i -1]);
var year =matrix[i].year;
}
我想看到最后一行将是第一行,其他如下例如year,11/2009-10/2009-09/2009-08/2009
I want to see last row will be the first row and others as followfor example year , 11/2009 - 10/2009 - 09/2009 - 08/2009
[edit]也就是说,我只想更改行顺序,而不想更改列[/edit]
[edit] That is to say, I only want to change the row order but not the column [/edit]
有实现它的任何想法吗?
Any idea to achieve it ?
谢谢
推荐答案
如何向后遍历矩阵?
for (var i = matrix.length-1; i >= 0; i--) {
var starttime= Date.UTC(parseInt(matrix[i].start_time);
var endtime = Date.UTC(parseInt(matrix[i -1]);
var year =matrix[i].year;
tbl_html = tbl_html + '<tbody>' +
'<td>' + yearconvert(yearr) + '</td>' +
'<td>' + starttime+ '</td>' +
'<td>' + endtime + '</td>';
}
这篇关于反转HTML网格数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!