Search code examples
javascriptjsgrid

JsGrid skip a row


I have a JsGrid implementation. In which I use some itemtemplates for calculations like:

 itemTemplate: function(value, item) {
      Total = Total + (item.SomeValue - item.SomeOtherValue);
          return(Total);
      }

Sometimes "Total" is empty. in that case I want to skip the complete row. Is there any way to do that? Now I end up with a lot of empty rows.

Thanks, Mike


Solution

  • itemTemplate is used for updating the cell in the row. If you want to manipulate row then you have to use callback function rowRenderer.

    rowRenderer: function(item,itemIndex){
        if('condition_to_skip_row'){ return null;}
        return '<h1>1<h1>';
    }
    

    For reference follow the jqGrid documentation - http://js-grid.com/docs/#configuration