angular-ui/ui-grid

UI Grid Validator and afterCellEdit function calls

Open

#5,577 建立於 2016年7月21日

在 GitHub 查看
 (7 留言) (0 反應) (0 負責人)JavaScript (2,496 fork)batch import
help wanted

倉庫指標

Star
 (5,395 star)
PR 合併指標
 (30 天內沒有已合併 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) { }); };

貢獻者指南