开发者

Getting a column value from ice:dataTable in the validator of another column

开发者 https://www.devze.com 2023-01-13 01:01 出处:网络
My ice:dataTable looks like below:- <ice:dataTable id=\"someTbl\" var=\"someVar\" value=\"#{someBean.someList}\" >

My ice:dataTable looks like below:-

<ice:dataTable id="someTbl" var="someVar" value="#{someBean.someList}" >
   <ice:column>  
       <f:facet name="header"> <ice:outputText value="#{msgs.tblCol1}"> </f:facet>
       <ice:outputText value="#{someVar.name}"/>
    </ice:column>
   <ice:column>  
       <f:facet name="header"> <ice:outputText value="#{msgs.tblCol2}"> </f:facet>
        <ice:selectInputDate id="startCal" value="#{someVar.startTime}"
                 renderAsPopup="true" renderYearAsDropdown="true"    
                 renderMonthAsDropdown="true" partialSubmit="true" >
                 <f:convertDateTime pattern="MM/dd/yyyy HH:mm" type="date" timeZone="EST"/> 
        </ice:selectInputDate>
    </ice:column>
    <ice:column>  
       <f:facet name="header"> <ice:outputText value="#{msgs.tblCol3}"> </f:facet>
        <ice:selectInputDate id="endCal" value="#{someVar.endTime}"
                 renderAsPopup="true" renderYearAsDropdown="true"    
                 renderMonthAsDropdown="true" partialSubmit="true" validator="#{someBean.validateEndtime}">
                 <f:convertDateTime pattern="MM/dd/yyyy HH:mm" type="date" timeZone="EST"/> 
        </ice:selectInputDate>
    </ice:column>
</ice:dataTable> 

When the validator on the second calendar (id "endCal") on the row is invoked, I want to get the value of the first calendar (id "startCa开发者_如何学Gol") on that row in my backing bean. Is there a way to accomplish that? I was wondering about ice:rowSelector but I noticed I can only get the rowId of the selected which means I will have to traverse through the "someBean.someList" in the validator method to find the values for that entry.


First bind the first input to bean:

<ice:selectInputDate id="startCal" binding="#{someBean.startCalComponent}" ... >

with this property:

private UIInput startCalComponent; // +getter+setter

Then, in your SomeBean#validateEndtime() method do:

Date startTime = (Date) startCalComponent.getValue();
0

精彩评论

暂无评论...
验证码 换一张
取 消