user3048027
user3048027

Reputation: 387

Cell Validation in ui-grid Angularjs

I am working in Angular ui-grid Now I have a requirement where in once cell got check box and in another cell editable text box.

The validation requirement should be if the check box is checked then the editable text box for that row is required field How can I do it.

<!doctype html>
<html ng-app="app">
  <head>
    <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.3/angular.js"></script>
    <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.3/angular-touch.js"></script>
    <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.3/angular-animate.js"></script>
    <script src="http://ui-grid.info/docs/grunt-scripts/csv.js"></script>
    <script src="http://ui-grid.info/docs/grunt-scripts/pdfmake.js"></script>
    <script src="http://ui-grid.info/docs/grunt-scripts/vfs_fonts.js"></script>
    <script src="http://ui-grid.info/release/ui-grid.js"></script>
    <link rel="stylesheet" href="http://ui-grid.info/release/ui-grid.css" type="text/css">
    <link rel="stylesheet" href="main.css" type="text/css">
  </head>
  <body>

<div ng-controller="MainCtrl">
  <div id="grid1" ui-grid="gridOptions" class="grid" ui-grid-edit ui-grid-cellnav></div>
  <br/>
  <br/>
  <button class="btn btn-default" ng-click="addUser()">Add row</button>
</div>


    <script src="app.js"></script>
  </body>
</html>

Please look at the pluncker

Upvotes: 0

Views: 1346

Answers (1)

Raghu Reddy
Raghu Reddy

Reputation: 186

You can add condition using ng-minlength and ng-maxlength. ng-minlength=\"(row.entity.employed)?3:''\" ng-maxlength=\"(row.entity.employed)?10:''\"'

Upvotes: 0

Related Questions