Multisort and cell class

I have multi-sorting enabled and have a class assigned based on the value of the cell. When my table loads it colors the correct cells with a background color, however if I sort the column, the class seems to stay in the same cells.

I am using a function in the cells() method to get the value of the cell on each render and set the class accordingly.

cells: (row, column, prop) => {
const commonValue = this.mostCommonColumnValueInColumn(column, row);

      if(commonValue) {
        cellProperties = {className: ''};
      else {
        cellProperties = {className: 'uniqueValues'};
      return cellProperties;

Is there a better place to put the class setting for the cells? Maybe in the afterSortFinish? I can put together a working fiddle tomorrow.


I have created a fiddle to replicate:

Thanks for the fiddle. You’re using getDataAtCell with physical indexes, so you get different value than you expect. Translate the indexes so they will not be dependant on sort order:

Thank Wojciech,

That worked great.