可以使用与displayProperty相同的datakey来访问jspdf autotable插件中对象的不同属性吗?
例:
var columns = [
{ title: "ID", dataKey: "id" },
{ title: "Name", dataKey: "person", displayProperty: "name" },
{ title: "Age", dataKey: "person", displayProperty: "age" },
];
var rows = [
{id: 1, person: {name: "AAAA", age: "123"}},
{id: 2, person: {name: "BBB", age: "321"}},
];
...
createdCell: function(cell, data) {
if (data.column.dataKey === 'person') {
var prop = data.column.raw.displayProperty;
cell.text = cell.raw[prop];
}
}
谢谢 .