| Author |
Disabling h:commandButtons in d:dataTables
|
Dimitris Karageorgopoulos
Greenhorn
Joined: Oct 11, 2010
Posts: 11
|
|
Dear all,
I use JSF 1.1
I have a dataTable that displays rows of data from a managed bean function of the type
public List<MyObject> getListOfDate()
Each row displayed is actually an h:commandButton. Inside the ActionListener of the commandButton, after some business specific actions, I want to disable the button
public void clickActionEvent(ActionEvent event){
if (event.getComponent() instanceof HtmlCommandButton){
//Business code
HtmlCommandButton rowButton = (HtmlCommandButton)event.getComponent();
rowButton.setDisabled(true);
}
}
However, this code instead of disabling the row button I click, it disables it all the buttons in all rows of the dataTable.
Is this default behaviour?
Is there any JSF way I can overcome it ?
|
 |
Tim Holloway
Saloon Keeper
Joined: Jun 25, 2001
Posts: 14480
|
|
If you add a boolean column to your datamodel row object you can use that to control enable/disable using the following syntax:
No JSF-specific code is required.
|
Customer surveys are for companies who didn't pay proper attention to begin with.
|
 |
 |
|
|
subject: Disabling h:commandButtons in d:dataTables
|
|
|