Set Cell Meta while Filtering

Hello,

Goal

My table auto saves every 60 seconds. Within those 60 seconds, a user can make multiple changes. These changes remain unsaved until the auto save timer reaches 0 seconds, or the user manually presses save. Therefore, I would like to visually distinguish which cells are currently unsaved by coloring them yellow.

My Current Approach

On each save, I iterate through every cell, modifying the cell properties like so:

cellProperties.savedValue = currentValue;

Then, in my render function, I do:

function myRenderer(instance, td, row, col, prop, value, cellProperties)
{
var savedValue = cellProperties.savedValue;

if (savedValue != value)
{
    td.style.backgroundColor = "yellow";
}

}

The Problem

This seems to work perfectly fine until filtering comes into play. The problem is as follows:

  1. While there are no filters active, change some values. The changed cells become yellow.
  2. Then, Filter out the rows with these changed cells.
  3. Then, Press Save. As far as I know, setCellMeta cannot access the filtered cells in order to update cellProperties.
  4. When I remove all filters, these cells are still colored yellow, because their properties were not set

Any help would be much appreciated!

Hi @mike

I think that you could use the beforeFilter callback to track changes related to filtering.

Also if you use the afterChange or beforeChange callback you should check if the changes array of 3rd and 4th elements are the same (equals to editing process without changes). However, it is still a theory. Please share a demo and I’ll see what can be done :slight_smile:

I am closing this issue as there is no update since 20th of June