0

Iam new to AngularJS,Can someone help me how can I display the dropdown in the ng-grid's cell.

Please help me with explanation and syntaxes.

Deepak Kothari
  • 1,601
  • 24
  • 31
  • see this one http://stackoverflow.com/questions/15907373/is-it-possible-to-have-a-select-drop-down-inside-of-the-angularjs-ng-grid[enter link description here][1] [1]: http://stackoverflow.com/questions/15907373/is-it-possible-to-have-a-select-drop-down-inside-of-the-angularjs-ng-grid – user3722785 Nov 28 '14 at 07:43

1 Answers1

0

You need to checnge the ng-grid's cell template here is the default cell template:

<div class="ngCellText" ng-class="col.colIndex()"><span ng-cell-text>{{row.getProperty(col.field)}}</span></div>

You will nee to update it like this:

 $scope.colors = [
      {name:'black', shade:'dark'},
      {name:'white', shade:'light'},
      {name:'red', shade:'dark'},
      {name:'blue', shade:'dark'},
      {name:'yellow', shade:'light'}
    ];
$scope.gridOptions = { 
        data: 'myData',
        columnDefs: [
             {field:'name', displayName:'Name', cellTemplate}, {field:'age', displayName:'Age'}]
    };
var myCelTemp = '<div class="ngCellText" ng-class="col.colIndex()"><span ng-cell-text>
<select ng-model="myColor" ng-options="color.name group by color.shade for color in colors">
  </select></span></div>'

This is an exmaple that i created via thise links

Angular js Select

ng_Grid templates

I hope this helps

Utku Apaydin
  • 162
  • 1
  • 4