Webix Datatable onCheck ServerSide

Hi,

It seems that onCheck function for a serverSide Datatable it repaints the whole Datatable so the selected row is colored until Datatable repaint itself.

 onCheck: function(row, column, state){
				    	this.addRowCss(row, "row-marked");
				    }


<style>
  .center{
    text-align:center;
  }
  .row-marked{
    background-color: #ffa;
  }
</style>

If you mean reloading while filtering (using “serverFilter”), then yes, all client-side changes will be lost. But onCheck doesn’t repaint the datatable, AFAICS. Can you provide a sample?

To preserve the highlighting/selection, you need to update the item itself:

  save:"data.php",
  on:{
    onCheck: function(row, column, state){
      // assuming that column corresponds to the boolean data attribute
      if (state) this.updateItem(row, {$css:"row-marked", column:state}) 
        else this.updateItem(row, {$css:"", column:state})
    }
  }

Hi Listopad,

I found the solution and works now, thanks for your answer