3

I have a problem to populate dropdowns as cell template in ui-grid table. Can anyone help me please?

var cellSelectTemplate = '<select ng-change="change(status, row.entity)" ng-model="status" ><option ng-repeat="stat in dataStatuses" value="{{stat.id}}">{{stat.status}}</option></select>';


$scope.gridOptions1.columnDefs = [
   {field: 'status', displayName: 'Status', width: '100', enableColumnMenu: false, cellTemplate: cellSelectTemplate},
];

$scope.loadData = function(){
$.GET(....).success(function(data){
  $scope.gridOptions1.data = data["table"];
  $scope.dataStatuses = data["statuses"];
});
}

Data are loaded after I will click the load button and call ng-click="loadData". All data were loaded to the table. If I debug $scope.dataStatuses variable, all data for statuses were loaded, but dropdown is still empty.

I used version with ng-options="stat.id as stat.status from stat in dataStatuses" as well, but without any effect.

Data are in folloving json format:

data[statuses]:[
{id:1;status:first},
{id:2;status:second},
...
]

data[table]:[
{id:1;status:1;........},
{id:2;status:1;........},
...
]
user990423
  • 1,397
  • 2
  • 12
  • 32
  • Maybe you simply need to [refresh](http://stackoverflow.com/questions/26634063/how-to-use-refresh-method-in-ui-grid) your grid as soon as you get the data? – Ilya Luzyanin Nov 23 '15 at 14:30
  • I don't understand what you mean. Data are loaded to the grid in the same success function and dropdowns are empty I added $scope.GridApi.core.refresh(); and didn't help me. – Milan Matúška Nov 23 '15 at 14:39
  • @MilanMatúška you should build a plunker with your issue to help others help you! – imbalind Dec 01 '15 at 16:17

0 Answers0