When or why do you choose a variable versus an attribute in UIDL?
Is there a pragmatic difference that is not clear from the API itself?
Thanks…
When or why do you choose a variable versus an attribute in UIDL?
Is there a pragmatic difference that is not clear from the API itself?
Thanks…
You should use variables when the value can be changed (from the client-side) - use attributes when the value can only be changed on the server-side. This differentiation is there mostly for historical reasons. It is likely that the communication protocol will be revised (simplified) in Vaadin 7 and the differentiation will also be removed.
Attributes are sent only from server to client side, variables can be sent both ways.
Generally when something does not need to be changed on client side, you should use attributes.
EDIT:
Bit too late
Thanks. I noted this is how it was done – following the TinyMCE lead, but since I was able to send data seemingly with either (depending on what chunk of code we copy-pasted from), it seemed odd when we noted the lack of consistency. So we now use attributes for everything we send to the client, and only have one variable for the content of the widget that goes both directions.