Docs
API
  • render

    Function

    Before grid cell will be updated with it's value, function render runs if it exist.

    Function render is mainly used for some not standard styling or formatting of cell value.

    Example: style

    
    render: function(o){
      if(o.value < 0){
        o.style = {
          color: '#E46B67'
        };
      }
      else{
        o.style = {
          color: '#65AE6E'
        };
      }
    
      o.value = o.value + '%';
    
      return o;
    }
    

    Example: cls

    Grid can not auto-detect used classnames in render method and requires help to clear cells from used classnames.

    
    new FancyGrid({
      cellStylingCls: ['green', 'red', 'yellow'],
      ...
      columns: [{
        ...
        render: function(o){
          if(o.value < 50000){
            o.cls = 'red';
          }
          else if(o.value > 90000){
           	o.cls = 'green';
          }
          else{
           	o.cls = 'yellow';
          }
    
          return o;
        }
    

    Default

    
    undefined