开发者

Link with navigation-rules in datatable / Not working

I have been trying to create a link in each row of a datable like that :

开发者_开发技巧
        <f:view>
        <h:form>
            <p:dataTable id="TasksList"
                         value="#{TaskController.tasks}"
                         var="task"
                         rendered="#{TaskController.currentCorbeilleId != null}">
                <p:column>
                    ...
                </p:column>
                <p:column>
                    ...
                </p:column>
                <p:column>
                    ...
                </p:column>
                <p:column>
                   ...
                </p:column>
                <p:column>
                    <f:facet name="header">
                        <h:outputText value="Link" />
                    </f:facet>
                    <h:commandLink value="GO" action="goToTask">
                        <f:setPropertyActionListener value="#{task.id}" target="#{TaskController.currentTaskId}"/>
                    </h:commandLink>
                </p:column>
            </p:dataTable>
        </h:form>
    </f:view>

But this is not working. When I click on "GO" the current page just reloads... I tried to copy/post this part of the code outside the datatable :

<h:commandLink value="GO" action="goToTask">
    <f:setPropertyActionListener value="#{task.id}" target="#{TaskController.currentTaskId}"/>
</h:commandLink>

And in the case the link works. How can I do to make it works within the datatable?

Thank you for your answers,

Martin


Try putting your TaskController bean into view scope. I had similar problems if the bean containing the collection for the datatable was request scoped!

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜