I am using angularjs
and ui-grid
with custom cellTemplate
. Each cell has an object as COL_FIELD
. This object is passed to a function which returns image data uri
used in src
attribute of cellTemplate
so each cell renders an image.
I have noticed that when I define the custom cellTemplate
as following:
<img src="{{grid.appScope.getCachedImg(COL_FIELD)}}" />
...Everything works BUT the functions for all cells and all rows are evaluated as the grid appears so it is slow to become responsive.
For testing purposes I tried the following cell template:
<img src="https://dummyimage.com/30x30/000/fff&text={{COL_FIELD.attributes.displayName[0]}}" />
...This works in the sense I wish as only the cells within the viewport make the server call.
What is the reason for this difference? How can I have this second behaviour but with a function returning image data uri
instead of a server call returning it. ANd have only the viewports cells request this as scrolled up or down?