-
FEATURED COMPONENTS
First time here? Check out the FAQ!
I have this in my template
<apply selected="@bind(vmApp.selected)" templateURI="/app/thg/equipments/equipments/EquipmentClass.zul" /
And then, in a button, I have:
<button zclass="z-button-list" label="Change" disabled="@load(empty vmApp.type or vmApp.upserting)" onClick="@command('update') @global-command('update')" />
Where the command update makes the vmApp.selected to change, and the global-command set some variables in the template. My problem is that the template is rendered after the global-command is executed. IS there any way to do this?
I updated the fiddle example following the same pattern, pass in a parameter edit="@load(outerVM.edit)" and use it in the InnerVM
http://zkfiddle.org/sample/3s936ku/12-Bind-command-and-global-command
Once you reach a stage where you think you have too many parameters passed into the template you can just send a more complex object containing both the object to show/edit and additional flags like editable, showDetails ...
global-commands just make your application hard to follow especially in this case where one ViewModel triggers creation of a nested ViewModel ... using parameters feels more natural just like calling a method with arguments -> call a template with parameters.
global commands should be used rarely to send commands between otherwise unrelated parts of your UI
Asked: 2017-08-10 16:35:02 +0800
Seen: 25 times
Last updated: Aug 11 '17
How to control selectAll() feature in a Listbox with multiple=true and checkmark=true
ZK8 Wizard Series: Part 2 now released!
Faster And Lighter, The Performance Test On ZK8
org.zkoss.xel.XelException: Resource not found: http://www.zkoss.org/dsp/web/core
How To Check Dirty Status in ZK8?
Come and join the ''JS'' Hunt!
I don't quite understand the scenario. Please provide a running example on https://zkfiddle.org. This will help to get a useful answer quickly.
cor3000 ( 2017-08-11 03:19:22 +0800 )editHi again. I reused the fiddle you sent me for this. In this fiddle, when you click in 'load' button, it should show the textbox with disabled=true, but it doesn't http://zkfiddle.org/sample/3s936ku/11-Bind-command-and-global-command
ajamardo ( 2017-08-11 06:32:43 +0800 )edit