如何在p:orderList中获取行索引?

时间:2012-10-25 07:42:14

标签: jsf jsf-2

我有一个简单的p:orderList实现,其中我显示了任务对象的数组列表,即任务名称和commandButton,它显示了有关任务的更多细节:

<p:orderList value="#{taskBean.tasks}" var="t" controlsLocation="none"
           itemValue="#{t}" id="tasks"/>
        <p:column>   
             <h:outputLabel value="#{t.name}"/>
        </p:column>

        <p:column><h:form>
           <p:commandButton title="Details" oncomplete="#{taskBean.details(t.id)}" 
              icon="ui-icon-document-b"/>
        </h:form></p:column>
</p:orderList>

该按钮调用bean方法,该方法在数组列表whit任务id中查找任务并显示它。 现在出于某种原因,在orderList的所有行中,我最后将whit(t.id)作为所有按钮的属性,因此它们都显示最后一个任务。

知道我该怎么办?

我的第二个问题是如何添加按钮以保存任务列表的当前顺序?

0 个答案:

没有答案