I'm trying to replace the functionality of an <h:dataTable> with nested an <s:link> actions for each row with a JavaScript grid built with ExtJS. I have all the data loading correctly except that I am running in to a problem where my JavaScript action only work when the dataTable is actually on the page. If I try to remove the <h:dataTable> then the functionality I've written into my JavaScript stops working even though the href from the rendered <s:link> is the exact same as the URL I am setting the location to in my JavaScript.
Here is my current setup:
<h:dataTable id="myList" var="item" value="#{myList.resultList}" rendered="#{not empty myList.resultList}"> <h:column> <f:facet name="header">Name</f:facet> #{item.name} </h:column> <h:column> <f:facet name="header">Actions</f:facet> <s:link id="archive" value="Archive" action="#{itemHome.archive}" rendered="#{item.isActive}"> <f:param name="itemId" value="#{item.id}"/> </s:link> </h:column> </h:dataTable>
This creates a link in the Actions column equivalent to:
<a href="/project/myList.seam?itemId=18&cid=30&actionMethod=myList.xhtml%3AitemHome.archive" id="j_id42:myList:12:archive">
Now I've recreated the href from the rendered <s:link> in JavaScript (below) which is being called from an onclick event.
location.href = "/project/myList.seam?itemId=18&cid=30&actionMethod=myList.xhtml%3AitemHome.archive";
The two strings are the same and should fire the same action but it only does this if and when the <h:dataTable> is defined on the page. Can anyone tell me why this happening?
Thanks,
- Justin