ui-grid icon indicating copy to clipboard operation
ui-grid copied to clipboard

Cell Validation

Open myGitHubForum opened this issue 12 years ago • 4 comments

I am able to do some validation using the ngGridEventEndCellEdit but want to show an error message on invalid input. Is it possible to do it?

myGitHubForum avatar Aug 20 '14 19:08 myGitHubForum

Does no one implement or work on validation of editable Cells? I am not sure why the grid is able to provide the editable cells but not provide the cell validations.

Can we add this to future development if it is not implemented? I would appreciate if someone respond to my issues.

Thanks.

myGitHubForum avatar Aug 22 '14 21:08 myGitHubForum

@myGitHubForum: the editable cell logic in 2.x is a little less than ideal, the logic in 3.0 is quite substantially different. Remember also that this is an open source project (= unpaid contributors) that has a large group of users, but until recently a very small group of contributors. Most of the effort is going into getting 3.0 ready, and there is little attention being devoted to enhancements or extensions to the about-to-be-deprecated versions.

Having said that, I think it is possible to complete validation messages if you're prepared to roll some of your own code. Validation isn't greatly different in concept from the requirement to send updates to the server once completed, so you could apply validation at the same point, and then come back to highlight any rows that are in error and perhaps put the error message on the top of your page (outside the grid). Some of the elements of that would probably be the ngBlur directive, information can be found here: http://stackoverflow.com/questions/15647981/angularjs-and-ng-grid-auto-save-data-to-the-server-after-a-cell-was-changed/ or here: http://technpol.wordpress.com/2013/12/06/editable-nggrid-with-both-dropdowns-and-selects/

PaulL1 avatar Sep 03 '14 09:09 PaulL1

See a proposal of validation at #4152

imbalind avatar Nov 12 '15 22:11 imbalind

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) { }); };

I hvae opened issue https://github.com/angular-ui/ui-grid/issues/5577 but no response yet.

parag-patil avatar Jul 22 '16 22:07 parag-patil