Tag Archives: JavaServer Faces

JSF – tomahawk dataTable and commandLink not working together

I was using tomahawk datatable. datatable’s rows have command link. this link will take to another page with a param. when i started working in it the datatable, it has rows on load and it was working well. then i added a drop down above it. so that i can filter the datatable. but this time it wasn’t working. this list page was binded to one bean and the action method is on the other bean. both of the bean was in request scope. change them to session scope might solve the problem. But i didn’t want to do that. finally I found a solution at http://forums.sun.com/thread.jspa?threadID=549675&start=60&tstart=0
I have just added ‘ <t:saveState id=”pagelist” value=”#{settingsList.settings}” /> ‘ line above the data table tag. and it worked.
<h:selectOneMenu value=”#{settingsList.settingsTypeValue}” id=”settingsType” styleClass=”select”>
<f:selectItems value=”#{settingsList.settingsTypes}” />
</h:selectOneMenu>
<h:commandButton value=”#{text[‘button.go’]}” action=”#{settingsList.show}” id=”go” styleClass=”button” />
<t:saveState id=”pagelist” value=”#{settingsList.settings}” />
<t:dataTable id=”settings” var=”setting” style=”margin-top: 10px” value=”#{settingsList.settings}” rows=”25″ sortColumn=”#{settingsList.sortColumn}” sortAscending=”#{settingsList.ascending}”>
<t:column>
<f:facet name=”header”>
<t:commandSortHeader columnName=”id” arrow=”true”>
<h:outputText value=”#{text[‘settings.id’]}” />
</t:commandSortHeader>
</f:facet>
<h:commandLink action=”#{settingsForm.edit}” value=”#{setting.id}”>
<f:param name=”id” value=”#{setting.id}” />
</h:commandLink>
</t:column>
<t:column>
<f:facet name=”header”>
<t:commandSortHeader columnName=”name” arrow=”true”>
<h:outputText value=”#{text[‘settings.type’]}” />
</t:commandSortHeader>
</f:facet>
<h:outputText value=”#{setting.settingsType}” escape=”true” />
</t:column>
<t:column>
<f:facet name=”header”>
<t:commandSortHeader columnName=”name” arrow=”true”>
<h:outputText value=”#{text[‘settings.name’]}” />
</t:commandSortHeader>
</f:facet>
<h:outputText value=”#{setting.settingsValue}” escape=”true” />
</t:column>
</t:dataTable>
Advertisements