Simple Table Example

Example to usage simpleTable

by edgardleal

HTML

<script src="//cdn.jsdelivr.net/jquery.simpletable/0.0.1/jquery.simpletable.min.js"></script>
<table></table>

JavaScript

$(function(){

$('table').simpleTable({
      'keyField' : 'Code', // used to dont redraw all table, just update the row with id 
      'columns' : [
        {'title' : 'Code', 'field' : 'Code', 'conditions': [ 
            {'expression' : 'value <=0 ', 'cell' : 'color : red'},
            {'expression' : 'value > 0 ', 'cell' : 'color : green'}
          ]},
        {'title' : 'Name'} // When field not informed, it will be assume 'title' = field
      ]
    });
   
    
    var data = [{Code : -1, Name : 'Mary Rose'},
                {Code : 2, Name : 'Jhon Mcdonald'}];
    
    $('table').simpleTable('option', 'data', data);
    $('table').simpleTable('refresh');
});