Author |
Message |
![[Post New]](/JForum/templates/default/images/icon_minipost_new.gif) 23/Apr/2008 21:36:28
|
maxi_ng
Joined: 11/Jan/2008 00:00:00
Messages: 92
Offline
|
I am using icefaces 1.7 and developed a portlet run in liferay.
I have a datatable and each row have a checkbox.
I want only one checkbox can be checked.
so, I have a on value change action on each checkbox,
and it was really called when I check any checkbox.
I get those value from the log of my app server, they have been
set to false but the checkboxes on the webpage is still checked!!
the variables I set to false is the value of that checkbox.
Why is this happening?
I have tested this a little bit.
If I call the clear method from a ice:commandbutton, those checkboxes wil be cleared, but if I call the same method from a value change event, those checkboxes won't be cleared!
How to clear them with the value change event??
Code:
<ice:dataTable id="eventTable" value="#{verify.eventList}" var="event" border="1">
<ice:column>
<f:facet name="header">
<ice:outputText value=""/>
</f:facet>
<ice:selectBooleanCheckbox partialSubmit="true" valueChangeListener="#{verify.clickEventCb}" value="#{event.selected}"/>
</ice:column>
<ice:column>
|
|
 |
![[Post New]](/JForum/templates/default/images/icon_minipost_new.gif) 24/Apr/2008 02:25:03
|
radu.jakab
Joined: 31/Oct/2007 00:00:00
Messages: 240
Offline
|
Please post the listener code.
|
|
 |
![[Post New]](/JForum/templates/default/images/icon_minipost_new.gif) 25/Apr/2008 03:47:12
|
maxi_ng
Joined: 11/Jan/2008 00:00:00
Messages: 92
Offline
|
fragment of backing bean
Code:
public void clickEventCb(ValueChangeEvent event){
this.clearAllCheckBox();
}
public void clearAllCheckBox(){
Event oEvent;
Iterator eventItrt = this.getEventList().iterator();
while(eventItrt.hasNext()){
oEvent = (Event) eventItrt.next();
oEvent.setSelected(false);
if(oEvent.getID() == this.attendControl.getEventId()){
this.setSelectedEvent(oEvent);
}
}
}
.jspx
Code:
<ice:portlet>
<ice:form>
<ice:outputStyle href="/xmlhttp/css/xp/rime-portlet.css"/>
<ice:outputStyle href="/resources/css/custom.css"/>
<ice:outputText id="returnStatus" visible="#{verify.returnStatusTxt}" value="#{verify.returnStatus}"/>
<ice:dataTable id="eventTable" value="#{verify.eventList}" var="event" border="1">
<ice:column>
<f:facet name="header">
<ice:outputText value=""/>
</f:facet>
<ice:selectBooleanCheckbox partialSubmit="true" valueChangeListener="#{verify.clickEventCb}" value="#{event.selected}" rendered="true"/>
</ice:column>
<ice:column>
<f:facet name="header">
<ice:outputText value="ID"/>
</f:facet>
<ice:outputText value="#{event.ID}"/>
</ice:column>
<ice:column>
<f:facet name="header">
<ice:outputText value="Name"/>
</f:facet>
<ice:outputText value="#{event.name}"/>
</ice:column>
<ice:column>
<f:facet name="header">
<ice:outputText value="Description"/>
</f:facet>
<ice:outputText value="#{event.description}"/>
</ice:column>
<ice:column>
<f:facet name="header">
<ice:outputText value="State"/>
</f:facet>
<ice:outputText value="#{event.state}"/>
</ice:column>
<ice:column>
<f:facet name="header">
<ice:outputText value="Capacity"/>
</f:facet>
<ice:outputText value="#{event.capacity}"/>
</ice:column>
<ice:column>
<f:facet name="header">
<ice:outputText value="Type"/>
</f:facet>
<ice:outputText value="#{event.type}"/>
</ice:column>
</ice:dataTable>
<ice:commandButton value="clear!!" action="#{verify.clearAllCheckBox}"/>
</ice:form>
</ice:portlet>
|
|
 |
![[Post New]](/JForum/templates/default/images/icon_minipost_new.gif) 25/Apr/2008 03:59:06
|
radu.jakab
Joined: 31/Oct/2007 00:00:00
Messages: 240
Offline
|
Hi maxi,
try changing this:
Code:
public void clickEventCb(ValueChangeEvent event){
if (!e.getPhaseId().equals(PhaseId.INVOKE_APPLICATION)) {
e.setPhaseId(PhaseId.INVOKE_APPLICATION);
e.queue();
return;
}
this.clearAllCheckBox();
}
Listeners are called before update model values in the request lifecycle so any changes you make in that phase are overwritten by the actual values in the page.
By changing the event's phase to UPDATE_MODEL_VALUES or INVOKE_APPLICATION your changes will overwrite those currently set in the page, which is what you need.
Regards
|
|
 |
![[Post New]](/JForum/templates/default/images/icon_minipost_new.gif) 25/Apr/2008 04:30:18
|
maxi_ng
Joined: 11/Jan/2008 00:00:00
Messages: 92
Offline
|
thx jakab,
this seems to work now, I will test it a little more.
btw, where can I get more about these kind of mechanism insight information?
|
|
 |
![[Post New]](/JForum/templates/default/images/icon_minipost_new.gif) 25/Apr/2008 05:42:17
|
radu.jakab
Joined: 31/Oct/2007 00:00:00
Messages: 240
Offline
|
Well you can start with some general JSF readings and then maybe try out the ICEFaces tutorials at http://www.icefaces.org/main/resources/tutorials.iface
I'm not really the most informed person to tell you abou twhat and where you should read though.
|
|
 |
|