I am still trying to figure out the exact steps to reproduce this outside of my project, but I am hoping there may be something obvious I am doing wrong that you could point out. I'm running into an issue where columns for some tasks are displaying field data for other tasks.
I noticed each row element has a data-id="someId" attribute and the cells within each column of the row have a data-portal-id="portal-someId-columnName" attribute. Usually the "someId" portion of these attributes are the same, but in some case they are not.
In the attached screenshot, you can see the data-id on the row is '6e0916ca-8894-4e1e-a8c2-08dc318de4b6", but in the start column the data-portal-id attribute is portal-188f63d3-309b-4263-a891-08dc318de4b6-start. Clearly the "ID" portion of this is different and I assume this is what's causing my issue. It seems like this happens for the first row / record to be added / updated by the scroll virtualization.
Is there anything obvious that might cause this? I know the snippet below isn't reproducible on it's own, but if it helps this is an example of the column config used for one of the columns that has this issue. It's also happening on other columns, not just date columns. I'm aware of the type: date config that could be used, but I need more control over rendering & formatting so I can't use that.
There's nothing wrong with the config as far as I see. Is there any chance that there's something wrong with your data? Because I have checked your config and used it inside our react javascript advanced demo which uses virtualization on scroll but it does show the correct data as you have mentioned. Probably you can try adding your data in that demo and see if the issue is reproducible there. In any case we need a test case to repro and assist you better.
I'm aware of the type: date config that could be used, but I need more control over rendering & formatting so I can't use that
Why not use the renderer on the date column that will help you to achieve the same format and control over rendering?
It seems like this happens when you call row.addCls inside of a column renderer. In my example, the name column renderer is supposed to conditionally add a class to the row if the row data has a value for the start field. I'm only setting a start date on the first record, yet if you scroll down you will see many rows with the blue background.
This is the issue. As you know we use virtualization and reuse the same rows, so when a cls is applied to a row, the same cls exists on the rows causing the issue. You just need to remove it. In your case you can do it in the else part:
That does work for the CSS class, but it's a bit more complex than just the CSS. There is "row pollution" when adding htmlEncode: false to the column renderer. If you run the below code, the first row only should have start / end dates. If you scroll to the bottom of the list, scroll back to top, and repeat that a few times you will see dates start being populated in other rows that should not have dates.
for performance reasons, we reuse rows and cells as you scroll the grid. And by default cells are not cleared before being reused, since DOM might have been directly manipulated in the renderer without us knowing about it. You can change this behavior by configuring your column with alwaysClearCell: true. Does that help?
From v6.0.0, this setting will be enabled by default.