Help

Built with Seam

You can find the full source code for this website in the Seam package in the directory /examples/wiki. It is licensed under the LGPL.

How to open an object which is member of a rich:dataTable

When you try to open an object which is a member of a datatable then you can only reference the object via JavaScript. Using the event onRowDblClick you can change the url of the current page to the selected objects webpage. But if you try to use the url MyPage.xhtml then you get an access denied error from Seam. Therefore you have to use the following syntax:

<rich:dataTable
        id="myDataTable" var="myObject"
        value="#{myEntityQuery.resultList}"
        rendered="#{not empty myEntityQuery.resultList}"
        onRowDblClick="location.href='/MyPage.seam?
                                myObjectId=#{myObject.id}';"
        rowKeyVar="rowNum">
...
</rich:dataTable>

The page MyPage.xhtml is a webpage like the pages generated by seam-gen where you pass an object id as JSF parameter when opening the page. In this example the parameter is named myObjectId. The value which is passed here is the id of the myObject instance of the object displayed in the row where the doubleclick is done.