如何更改 table 上的一些数据?
How to change some data on the table?
我正在尝试将显示在 table 上的信息更改为显示在 table <td>
左侧的信息。这是我的代码:
var tableData = [
[null],
["${apiInstanceList[0].serverName}"],
["${apiInstanceList[1].serverName2}"]
];
var cheapestByAirlineByLeg_data1 = [];
var cheapestByAirlineByLeg_data2 = [];
var cheapestByAirlineByLegChart = anychart.column();
<g:each in="${apiInstanceList}" var="apiInstance">
<g:each in="${apiInstance.cheapestByAirlineByLegMap}" var="leg">
var entry = [];
entry.push("${leg.legs}");
entry.push("${leg.price}");
<g:if test="${apiInstance.id % 2 == 0}">
cheapestByAirlineByLeg_data2.push({x: entry[0], value: entry[1]});
tableData[0].push(entry[0]);
tableData[1].push("$"+entry[1]);
</g:if>
<g:else>
cheapestByAirlineByLeg_data1.push({x: entry[0], value: entry[1]});
if(tableData[0].indexOf(entry[0]) == -1){ tableData[0].push(entry[0]); }
tableData[2].push("$"+entry[1]);
</g:else>
</g:each>
</g:each>[enter image description here][1
这是页面的样子。例如,我无法将 de [B6, B6] 更改为 GDSQA1。
您应该像使用列数组而不是行数组一样在初始化时使用 dataTable。
那么你应该改变将数据推送到tableData的顺序。你应该推到列,而不是行。
我正在尝试将显示在 table 上的信息更改为显示在 table <td>
左侧的信息。这是我的代码:
var tableData = [
[null],
["${apiInstanceList[0].serverName}"],
["${apiInstanceList[1].serverName2}"]
];
var cheapestByAirlineByLeg_data1 = [];
var cheapestByAirlineByLeg_data2 = [];
var cheapestByAirlineByLegChart = anychart.column();
<g:each in="${apiInstanceList}" var="apiInstance">
<g:each in="${apiInstance.cheapestByAirlineByLegMap}" var="leg">
var entry = [];
entry.push("${leg.legs}");
entry.push("${leg.price}");
<g:if test="${apiInstance.id % 2 == 0}">
cheapestByAirlineByLeg_data2.push({x: entry[0], value: entry[1]});
tableData[0].push(entry[0]);
tableData[1].push("$"+entry[1]);
</g:if>
<g:else>
cheapestByAirlineByLeg_data1.push({x: entry[0], value: entry[1]});
if(tableData[0].indexOf(entry[0]) == -1){ tableData[0].push(entry[0]); }
tableData[2].push("$"+entry[1]);
</g:else>
</g:each>
</g:each>[enter image description here][1
这是页面的样子。例如,我无法将 de [B6, B6] 更改为 GDSQA1。
您应该像使用列数组而不是行数组一样在初始化时使用 dataTable。 那么你应该改变将数据推送到tableData的顺序。你应该推到列,而不是行。