下記のようにui-gridのcellTemplateを動的に変えたいので1行のデータ(row.entity?)を使いたいのですが、ReferenceError: row is not defined となってしまいます。何か書き方が間違っているのでしょうか?
javascript
1vm.gridOptions = { 2 (~中略~) 3 columnDefs: [ 4 (~中略~) 5 }, { 6 name: month0, 7 field: 'month0', 8 width: monthWidth, 9 cellTemplate: createDateCellTemplate(row.entity, 0) ★ここでReferenceError: row is not defined 10 11 12(~中略~) 13/** 14 * 日付セルのcellTemplate設定 15 */ 16function createDateCellTemplate (entity, index) { 17 var colField = entity['month' + String(index)] 18 if (colField.length == 0) { 19 return '<div></div>'; 20 } else { 21 return '<button class="btn btn-block btn-gray" ng-click="vm.clearBtnAction()">{{COL_FIELD}}</button>'; 22 } 23}
★環境
AngularJS 1.2(?)
Chrome 70.0.3538.102
あなたの回答
tips
プレビュー