从另一列的验证器中的ice:dataTable获取列值

发布于 2024-09-16 07:21:40 字数 1570 浏览 5 评论 0原文

我的ice:dataTable如下所示:-

<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> 

当调用该行上的第二个日历(id“endCal”)上的验证器时,我想获取我的支持中该行上的第一个日历(id“startCal”)的值豆。有办法实现吗?我想知道ice:rowSelector,但我注意到我只能获取所选内容的rowId,这意味着我必须遍历验证器方法中的“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 "startCal") 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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

乖乖兔^ω^ 2024-09-23 07:21:40

首先将第一个输入绑定到 bean:

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

使用此属性:

private UIInput startCalComponent; // +getter+setter

然后,在您的 SomeBean#validateEndtime() 方法中执行以下操作:

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

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();
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文