Skip to content

[ui-grid 3.0.0-rc16] Unable to change value of 'enableCellEdit' for a column definition after initial grid load #2240

Closed
@pmariduena

Description

@pmariduena

Hello,

I want to be able to allow the user to add a new rows and initialize all of the columns of that row...but certains columns should then become non-editable after initial initialization (particularly, the one composing the key on the database).

Ex:
$scope.columnsSelected = [
{field: 'id', displayName: 'Identifier', enableCellEdit: false},
...
{field: 'startDate', displayName: 'Start Date', type: 'date', enableCellEdit: true, cellFilter: 'date:"dd-MMM-yyyy"'},
}
];

        $scope.gridOptions = {
            columnDefs: 'columnsSelected',
            data: $scope.myData,
            enableFiltering: true,

...
}

Without even trying to modify enableCellEdit property on the $scope.columnsSelected[0].enableCellEdit = true....I see an error on the browser.

TypeError: undefined is not a function
at Grid.getColDef (http://localhost:9091/bower_components/angular-ui-grid/ui-grid.js:3636:43)
at Grid.buildColumns (http://localhost:9091/bower_components/angular-ui-grid/ui-grid.js:3733:17)
at dataWatchFunction (http://localhost:9091/bower_components/angular-ui-grid/ui-grid.js:2923:37)
at Object.$watchCollectionAction as fn
at Scope.$digest (http://localhost:9091/bower_components/angular/angular.js:12541:29)
at Scope.$apply (http://localhost:9091/bower_components/angular/angular.js:12806:24)
at done (http://localhost:9091/bower_components/angular/angular.js:8379:45)
at completeRequest (http://localhost:9091/bower_components/angular/angular.js:8593:7)
at XMLHttpRequest.xhr.onreadystatechange (http://localhost:9091/bower_components/angular/angular.js:8532:11)angular.js:10072 (anonymous function)angular.js:7364 (anonymous function)angular.js:12560 Scope.$digestangular.js:12806 Scope.$applyangular.js:8379 doneangular.js:8593 completeRequestangular.js:8532 xhr.onreadystatechange

Is there any way to do this?

This plnkr can be a starting point.
http://plnkr.co/edit/2A7jsaCZvBRu8iV615F1

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions