Virtualization doesn't work correctly.
See this plunker
All the rows exept first 5 are empty, but if you scroll down, and then scroll up you will see that the data from first 5 rows is displayed on other rows.
Seems to have something to do with the component. Virtualization works fine when using the cell template directly with row.entity[col.field] instead of cell component.
https://plnkr.co/edit/PtwOdj8gevvYn82KkbKy?p=preview
Edit:
Narrowed it down to this.cellData being set in the component controller. Works fine if passing the cellvalue directly. Seems to have something to do with getCellValue. I'm guessing it's related to the return col.cellValueGetterCache(row)
https://plnkr.co/edit/tMhYzs1lJ5dZOiPFyIeC?p=preview
Edit: This also works correctly https://plnkr.co/edit/B2Zwga1d6urok8CmRzmf?p=preview
Thanks, good to know there is a workaround for this!
@Atmos206 Actually, in our project we are not displaying cell data right away - we have to proccess it, before we pass prepared data into component template. So we use additional service for this - see this plunker https://plnkr.co/edit/ltir5aQzB0C77pqG9IWC?p=preview
As you can see if we add this additional step, the bug is seen again. So we do our processing when controller is run. Correct me if I'm wrong that when we scroll ui-grid replaces the data in the row, to prevent rerendering and additional dom manipulations. So, how can we track this change of data to trigger our proccessing? I tried $watch the cellData, but the watcher triggers only when we scroll down. Why it doesn't trigger when we scroll up?
So this https://plnkr.co/edit/LxqoohuYVSyXsMNnaesr?p=preview doesn't work. What do you recommend to do?
@dKab The issue seems to lie within setting the data property within the component controller. I've changed the plnkr to apply cellContentService.renderCellContent within dataGenerator.generate as opposed to within the component controller.
If we just reference the bound property $ctrl.cdata within the cell template, no problems:
https://plnkr.co/edit/1v1rIekSWpoRMLjuSh27?p=preview
However, if we set self.data = self.cdata within the component controller, and reference $ctrl.cdata, we now see the problem presenting itself again:
https://plnkr.co/edit/JwrWGfth6hGXL34o82Ly?p=preview
Why does this happen? Not sure about that. Seems the best approach is to do any data modification outside the component controller, and reference bound properties directly, instead of setting them in the component controller. Hope this is helpful!
It seems no matter where you are proccessing the data (in controller or somewhere else) it will work as long as you do it with binded value. I've modifyied your latest plunker moving call to renderCellContent back to controller and removed the line self.data = self.cdata;
Now, if we pass binded property cdata to renderCellContent directly and reference cdata in template it works:
https://plnkr.co/edit/LxqoohuYVSyXsMNnaesr?p=preview
@dKab Nice! Good idea!!