dataTable & filter and column w/ commandLink doesnt work

UI Components for JSF
Post Reply
vikas_kumar_24
Posts: 17
Joined: 06 Mar 2011, 09:46

04 Jun 2011, 01:19

Hi,
Primefaces 3.0 M1
I have a simple datatable with filters on. And in the last cell of the table I've a command link to show details some based on that cell's data.

Fri Jun 03 16:04:25 PDT 2011 ACCEPTED Accepted 2.0.0 2.0.0
Fri Jun 03 16:04:25 PDT 2011 DECLINED Accepted 1.0.9 1.0.9
Fri Jun 03 16:04:25 PDT 2011 ACCEPTED Accepted 1.0.8 1.0.8

Now when I click on the last cell of each row, i open a dialog box and show some details, for now it's same as that cell's value say 2.0.0 so the dialog box also shows 2.0.0. Perfectly fine.

Now the issue, now on that column i have a filter, and i put 1.0 in the filter, and the data is as below:
Fri Jun 03 16:04:25 PDT 2011 DECLINED Accepted 1.0.9 1.0.9
Fri Jun 03 16:04:25 PDT 2011 ACCEPTED Accepted 1.0.8 1.0.8
Fri Jun 03 16:04:25 PDT 2011 PENDING Accepted 1.0.7 1.0.7

Now if i click on say 1.0.9 link, I still see 2.0.0. that's the problemI tested this with several cells, the data SHOWN is as if there is NO FILTERING done back on the model object.

<p:dataTable id="historyTable" var="agreementHistory" value="#{agreementMgmtBean.historyList}"
rows="12" paginator="true"
paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
rowsPerPageTemplate="9,12,15">

<p:column sortBy="#{agreementHistory.date}" filterBy="#{agreementHistory.date}">
<f:facet name="header">Date</f:facet>
<h:outputText value="#{agreementHistory.date}" />
</p:column>
<p:column sortBy="#{agreementHistory.status}" filterBy="#{agreementHistory.status}">
<f:facet name="header">Status</f:facet>
<h:outputText value="#{agreementHistory.status}" />
</p:column>
<p:column sortBy="#{agreementHistory.description}" filterBy="#{agreementHistory.description}">
<f:facet name="header">Description</f:facet>
<h:outputText value="#{agreementHistory.description}" />
</p:column>
<p:column sortBy="#{agreementHistory.version}" filterBy="#{agreementHistory.version}">
<f:facet name="header">Version</f:facet>
<h:outputText value="#{agreementHistory.version}" />
</p:column>
<!--
<p:column sortBy="#{agreementHistory.who}">
<f:facet name="header">Who</f:facet>
<h:outputLink id="readPolAndGuideHyperlink"
value="#{agreementHistory.who}"
onclick="showUserDetails(userInfoDialogWidget,this);return false;">
<h:outputText value="#{agreementHistory.who}" />

</h:outputLink>
</p:column>
-->
<p:column sortBy="#{agreementHistory.who}">
<f:facet name="header">Who</f:facet>
<p:commandLink id="agreementHistoryWho"
value="#{agreementHistory.version}"
process="@this"
actionListener="#{agreementMgmtBean.selectedHistory}"
update="userDetail"
oncomplete="userInfoDialogWidget.show()">
<f:setPropertyActionListener value="#{agreementHistory}" target="#{agreementMgmtBean.selectedHistory}" />
</p:commandLink>
</p:column>
</p:dataTable>


<p:dialog header="User Detail"
widgetVar="userInfoDialogWidget"
width="200"
height="175"
modal="true">
<p:outputPanel id="userDetail" style="text-align:center;" layout="block">
<h:panelGrid columns="2" cellpadding="5">
<h:outputLabel for="userName" value="User Name:" />
<h:outputText id="userName" value="#{agreementMgmtBean.selectedHistory.who}" />

<h:outputLabel for="version" value="Version:" />
<h:outputText id="version" value="#{agreementMgmtBean.selectedHistory.version}" />

<h:outputLabel for="status" value="Status:" />
<h:outputText id="status" value="#{agreementMgmtBean.selectedHistory.status}" />

</h:panelGrid>
</p:outputPanel>
</p:dialog>

Anyone knows if I could be doing something wrong? I also scanned the forum before starting this thread.

Thanks,
Vikas

smallya
Posts: 264
Joined: 19 Mar 2010, 19:22
Contact:

04 Jun 2011, 18:45

Vikas
Put the p:outputPanel outside the p:dialog and it should work.
Netbeans 7.2| GlassFish 3.2 | PostgreSQL 9.1| MongoDB | Primefaces 3.4.2
_______________________________________________________________
Subraya Mallya
http://tinyhabit.com |http://twitter.com/tinyhabit

neit
Posts: 6
Joined: 23 Feb 2011, 09:37

23 Jun 2011, 22:04

Hi,

I have a similar problem. In my application there's a datatable with filtering enabled and a p:commandLink in each row, which should navigate to another page giving more details about the selected row (action="bean.navigate(row)" where row is the datatable var). But my datatable produces the same unexpected behaviour as Vikas' datatable. I get the wrong row.

Any suggestions how to fix this?

vikas_kumar_24
Posts: 17
Joined: 06 Mar 2011, 09:46

23 Jun 2011, 22:42

Neit,
Actually Subraya suggested that I put the below suggestion
"Put the p:outputPanel outside the p:dialog and it should work."

Basically currently I've as:
<p:dialog>
<p:outputPanel

But Subraya is suggesting to try the reverse way

<p:outputPanel >
<p:dialog>

But I've not been able to try that yet, I'll soon try that.

Thanks,
Vikas

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 35 guests