angular-ui/ui-grid

UI Grid Validator and afterCellEdit function calls

Open

#5,577 opened on 2016年7月21日

GitHub で見る
 (7 comments) (0 reactions) (0 assignees)JavaScript (2,496 forks)batch import
help wanted

Repository metrics

Stars
 (5,395 stars)
PR merge metrics
 (30d に merged PR はありません)

説明

Hi,

I am using UI grid with validator module. I have below field with validator. I have written custom datatype validator.

{field: 'Qty', displayName: 'Qty', width: '10%', validators: { required: true, datatype: 'int' }, cellTemplate: 'ui-grid/cellTitleValidator'}.

My validator is being called correctly once I edit the cell but in below function, rowEntity is not being updated correctly for rowEntity['$$errors' + colDef.name]. Seems till the time below function is called, validator moudle has not added ($$error) property for rowEntity. My requirement is, if rowEntity do not have property with $$error+.... then save record otherwise do nothing. Is there way to run below function only after validator has updated the rowEntity?

//After cell Edit is completed. $scope.Grid.onRegisterApi = function (gridApi) { $scope.gridApi = gridApi; gridApi.edit.on.afterCellEdit($scope, function (rowEntity, colDef, newValue, oldValue) { }); };

コントリビューターガイド