2016-03-17 111 views
1

我有一个绑定为field的列,名为state,其值为SL。我想这个映射到以下几点:根据条件设置单元值

S =>ShortL =>Long

这是怎么结合的定义:

$scope.gridOptions = { 
     enableSorting: true, 
     enableFiltering: true, 
     enableHorizontalScrollbar: 0, 
     columnDefs: [ 
     {name: 'action', field: 'state', width: 110, enableFiltering: false} 
] 
    }; 

我已经使用cellclasscelltemplating,但分别用于类应用程序或事件绑定。如何根据ng-if设置单元格值?

+0

你的问题不明确。第一,这是条件?根据你想在单元格中设置S或L? – dpaul1994

+0

我在[@nabinca post here]找到了我的答案(http://stackoverflow.com/a/26867340/830037) – faizanjehangir

+0

很高兴听到:) – dpaul1994

回答

1

如果有帮助的人,我最后做的:

let stateTemplate = "<div>{{row.entity.state == 'L' ? 'Buy' : 'Sell'}}</div>" 

$scope.gridOptions = { 
     enableSorting: true, 
     enableFiltering: true, 
     enableHorizontalScrollbar: 0, 
     columnDefs: [ 
     {name: 'action', field: 'state', cellTemplate: stateTemplate, enableFiltering: false} 
], 
data: someData 
    }; 
相关问题