-
FEATURED COMPONENTS
First time here? Check out the FAQ!
I have created a ZK application via MVC which provides a dialog which contains a form with a button and textboxes. In this form the startProcessButton should trigger, once it's clicked, a process that does a specific operation. While this operation is ongoing, the button and textboxes should be disabled. Once the operation is finished, the components should be enabled again. It seems simple, but the button and the textboxes don't seem to be disabled when the button is clicked. I expect the button to change style, but it remains the same as it is. I believe this is an event-related issue, but I don't have much experience in this matter. I would really appreciate help for this, thanks in advance!
public void onClick$startProcessButton(Event evt) {
disableAllComponents(true);
startProcess();
}
private void startProcess() {
//do something
//re-enable the components
disableAllComponents(false);
}
private void disableAllComponents(Boolean condition) {
if (condition) {
startProcessButton.setSclass("button-disabled");
} else {
startProcessButton.setSclass("button");
}
startProcessButton.setDisabled(condition);
registrationNumberTextBox.setDisabled(condition);
accountHolderTitleComboBox.setDisabled(condition);
accountHolderNameTextBox.setDisabled(condition);
accountHolderSurnameTextBox.setDisabled(condition);
accountHolderCodeTextBox.setDisabled(condition);
}
If it's a long blocking operation you could do the following in the zul :
<button autodisable="self" />
If it's a non blocking operation, try this in the zul :
<button autodisable="+self" />
But you need to set the butto back correct in the controller after the long operation with :
button.setDisabled(false);
Now because you want to disable everything I suggest the following :
Clients.showBusy("Processing");
after the operation clear it with :
Clients.clearBusy();
Greetz chill.
Asked: 2015-02-11 17:50:09 +0800
Seen: 80 times
Last updated: Feb 11 '15