# Difference between @load() and ${} asked 2017-12-18 16:50:32 +0800 adilov 3 1 Hello everyone, I have a question about value loading in the .zul files. What's the difference between @load() and${}?

What I found is that with $, the casting for the lists does not work, for example when loading values for listbox or combobox. The other and not so obvious thing is that every value that has been loaded with$ cannot be "updated" using "@NotifyChange" annotation from the java/view model part. These two work fine with @load.

Is there a benefit to use ${} instead of @load() when loading something that wont change in some point of usage, e.g. dropdown menus, etc? Thank you :) delete retag edit ## 3 Replies Sort by » oldest newest answered 2017-12-18 22:27:24 +0800 chillworld 5322 4 9 https://github.com/chillw... ${} and @init() are more equal then ${} and @load() in your question. The ${} is a static reference, who if filled in at another time then the MVVM annotations.
Indeed, it's not a MVVM annotations and also static, so loaded once, never change again.
The @init is almost the same loaded once, never change again expect if you are working with the if attribute of a component.
There will work only the ${} because the if is evaluated before the whole MVVM. Hope this clears enough. answered 2017-12-22 13:52:10 +0800 adilov 3 1 Hi, sorry for the late reply, as a new user I couldn't post a new answer sooner than 2 days after my first one... This useful information, thank you! Is there any performance (or other?) benefit to use the static reference${} instead of @init or @load when the value is needed only for displaying purposes? E.g. faster, lighter?

cor3000
4293 1 7

the static expressions ${} are definitely more-lightweight than the data-binding annotations @load/@init.${} expressions are replaced almost instantly when the zul is parsed and components are created and no additional mechanics will change them later.

Annotations are parsed as well but only added as meta information to a component (consumes a bit memory). A bit later, when the BindComposer kicks in it will find those annotations and evaluate them - @init() only once, @load() will evaluate initially and again on notify-change or conditional @load(... after/before='command'). This kind of Bind tracking requires additional memory and processing overhead. So if not needed don't use @load and prefer @init or ${}. A bit similar topic was mentioned in one of our dos and don'ts articles. short answer: cheaper${} < @init < @load < @bind more expensive

[hide preview]