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.
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.
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
I hope this helps