0
我使用的是pivottable.js插件here。pivottable.js集合器
pivottable.js聚合器documentation。
我想将我的数据用于“用户”作为数据透视表单元格中的值。现在我正在访问我的info []数组中的用户数据。我也将它设置为当前的“行”值。我想修改这个,以便“用户”将成为我表中的单元格的VALUE。
function refreshTable(){
console.log("Starting Pivot Table Population");
//ajax start
$.get(
"table.php",
function(data){
//loop through the data and feed to the pivotUI
var info = [];
for (var ii=0; ii < array.length; ii++) {
info.push({
Skill: array[ii][0],
Users: array[ii][3],
IOT: array[ii][1],
IMT: array[ii][2],
Level: array[ii][4]});
}
console.log(info);
//pivot UI
$('#output').show();
$("#output").pivotUI(
info,
{
rows: ["Row","Users"],
cols: ["Col1","Col2","Col3"]
}
);
}
//end of ajax function "TYPE"
, "json")
};
FYI:这个库不叫'pivot.js'而是'pivottable.js' – nicolaskruchten