AbstractJavascriptComponent onStateChange called when using RPC

Hello All,

I’ve been scratching my brain all day. hehe.

I’ve made a component that requires a large 2D array to hold it’s data, I use push every few seconds to keep the updates timely and the updates I make are only a very small portion of the large 2D array.

The problem is that onStateChange for the AbstractJavascriptComponent is sending the entire 2D array with each tiny update. So I decided to use RCP for each array column and leave the static component variables in the shared state component.

That is fine until I use it in a tabsheet as it only calls onStateChange to restore the component state. So I added a method to the onStateChange function on the client side that called the server to request the full updated 2D array whenever the onStateChange was called (kinda silly) and I made sure I did not call getState() (that marks the connector as dirty, markAsDirty()) after the initialisation.

What happens is that using RCP via callFunction() marks the connector as dirty which triggers the onStateChange() on the client side and causes my program to loop. I found this ticket and was attempting to do some workarounds but have had no success yet. https://dev.vaadin.com/ticket/19828

Any help will be greatly appreciated

Hayden Dekker

Hi,

As the client-side widget and connector are reinitialized from scratch when they are hidden and redisplayed in a TabSheet, it should be enough to send the data request RPCs in the initialization function of your javascript connector.

Ahh, so simple. Works perfectly. Thanks again.