vaadin / grid-renderers-collection-addon

Collection of Grid Renderers (Vaadin7)
Apache License 2.0
4 stars 16 forks source link

Client site caching for EnabledProvider? #56

Closed onlineandy closed 5 years ago

onlineandy commented 5 years ago

Regarding #46:

I think it the EnabledProvider is called even when scrolling through the grid and no data is changed. This produces unnessacary networkrequests. Normally no problem for uns, but unter certain conditions its a little bit slow.

Is it prossible to implement a client side caching, so that the state is only synced with the server when data (for the row) has changed?

onlineandy commented 5 years ago

Or maybe pause the sync while scrolling and then resync when stopped?

TatuLund commented 5 years ago

Your concern is valid. That is the reason why added "Note: Using the function will add an additional server round trip in the rendering process and with slow network connections may impact Grid rendering performance." when I created the feature.

TatuLund commented 5 years ago

Implementing this feature is not going to be easy. A renderer does know only the row where it is, so it is not well aware of what happens outside it.

TatuLund commented 5 years ago

Or maybe pause the sync while scrolling and then resync when stopped?

After some study, I also came to conclusion, that it would be more plausible approach.

It will require some native JavaScript magic, but could work.

TatuLund commented 5 years ago

In version 2.5.0 there alternative mode added. It is a bit more complex to use, but produces less RPC calls.

https://vaadin.com/directory/component/grid-renderers-collection-for-vaadin7/api/org/vaadin/grid/cellrenderers/EditableRenderer.html#setIsEnabledProvider-com.vaadin.data.ValueProvider-boolean-