Handsontable example

by kranthi2210

HTML

<div id="example1" class="hot handsontable htColumnHeaders"></div>

CSS

</style><!-- Ugly Hack due to jsFiddle issue -->

<script src="https://cdn.jsdelivr.net/npm/handsontable@8.3.1/dist/handsontable.full.min.js"></script>
<link type="text/css" rel="stylesheet" href="https://cdn.jsdelivr.net/npm/handsontable@8.3.1/dist/handsontable.full.min.css">
<script src="https://handsontable.com/docs/8.3.1/components/numbro/dist/languages.min.js"></script>

JavaScript

var container = document.getElementById('example1'),
   hot = new Handsontable(container, {
     data: [{
       id: 5,
       number: 23
     }, {
       id: '',
       number: 3
     }, {
       id: 5,
       number: 18
     }, ],
     colHeaders: true,
     columns: [{
         data: 'id',
          type: 'numeric',
         required:false,
         validator: function(value, callback) {
             if(value>10 || value<4){
              callback(false);
             }else{
              callback(true);
             }
         	
         }
       },
       {
         data: 'number',
         type: 'numeric',
         required:true,
         validator: function(value, callback) {
             if(value>30 || value<4){
              callback(false);
             }else{
              callback(true);
             }
         	
         }
       },
     ]
   });

hot.validateCells()