hi, I am developing angular js application In which i am using angular ui-grid to display bind the data coming from mvc controller.But after i bind data to ui-grid i want to add extra column to grid having buttons on each row dynamically.I dont know how to do it.Any help will be grateful..
code: Here columnDefs will be binded to http service method that will call mvc controll action and bind response.I want to add new column now.That will have buttons for each row.Is there any to bind array to field of columnDefs:
$scope.gridOptions = {
enableColumnsResize: true,
enableSorting: false,
enableFiltering: false,
autoResize: true,
enableFocusedCellEdit: true,
enableCellSelection: true,
enableCellEditOnFocus: true,
enableColumnMenus: false,
columnDefs: [
],
data:$scope.swap,
onRegisterApi: function (gridApi) {
$scope.grid1Api = gridApi;
}
};
$http.get('/Default1/GetJsonData')
.success(function (result) {
$scope.swap = result;
$scope.gridOptions.push({name:'newcol',filter:'newcolarray'})
$scope.gridOptions.data = $scope.swap;
console.log(result);
})
.error(function (data) {
console.log(data);
});