var data = [{"Id":40072,"Id2":40071,"SmDetails":{"Id1":40071,"Id2":40072}}]
我想在列中顯示SmDetails.Id1
。這怎麼可能?我想:如何將列映射到SlickGrid中的複雜對象
var columns = [{name:'Personnel',field:SmDetails.id1,id:'detailId'}];
請幫我 請幫我
**My latest code**
var data = [{"Id":40072,"Id2":40071,"allocationDetails":{"Id1":40071,"allocationDetails":{"accommodationId":4007}}}]
var grid;
var columns = [ {name:"Personnel",field:"allocationDetails",fieldIdx:'accommodationId', id:"accommodationId"}];
var options = {
enableCellNavigation: true,
enableColumnReorder: false,
dataItemColumnValueExtractor:
function getValue(item, column) {
var values = item[column.field];
if (column.fieldIdx !== undefined) {
return values && values[column.fieldIdx];
} else {
return values;
}}};
var gridData=$scope.Vo;//This return as json format
grid = new Slick.Grid("#testGrid",gridData, columns);
This is the code tried recently.
嘗試'SmDetails.Id1'(我是大寫) –
是的,我嘗試過相同的方式,但它沒有工作。 – user3319065