ui-grid icon indicating copy to clipboard operation
ui-grid copied to clipboard

Help with Array in columnDefs

Open eddi0815 opened this issue 12 years ago • 2 comments

Hallo, I don't know if I'm right here. Please refer this to the right place if I'm wrong. The data: An array of Objects with an array of Objects: [ { sid:"bla", data: [{ time: 0, value: 0 }] }]

The columnDef: $scope.gridOptions = { data: 'chosenSignals', columnDefs: [ {field:'sid', displayName:'Signal-Id'}, {field:'data[0].value', displayName:'Wert'} // 1.
] };

  1. At the moment the first Value is displayed correctly. How is it possible to display the last value of data? data.length -1 doesn't work.

Thanks

eddi0815 avatar Feb 06 '14 16:02 eddi0815

I would transform your data array. The grid is set up to map each row to an array element, not multiple rows to various properties inside a single array element. On Feb 6, 2014 10:19 AM, "eddi0815" [email protected] wrote:

Hallo, I don't know if I'm right here. Please refer this to the right place if I'm wrong. The data: An array of Objects with an array of Objects: [ { sid:"bla", data: [{ time: 0, value: 0 }] }]

The columnDef: $scope.gridOptions = { data: 'chosenSignals', columnDefs: [ {field:'sid', displayName:'Signal-Id'}, {field:'data[0].value', displayName:'Wert'} // 1.

] };

  1. At the moment the first Value is displayed correctly. How is it possible to display the last value of data? data.length -1 doesn't work.

Thanks

Reply to this email directly or view it on GitHubhttps://github.com/angular-ui/ng-grid/issues/974 .

c0bra avatar Feb 06 '14 17:02 c0bra

try using a cellTemplate for {field:'data[0].value', displayName:'Wert'}

theluckin avatar Feb 09 '14 01:02 theluckin