开发者

JSF datatable working with two sets of data

开发者 https://www.devze.com 2023-02-26 17:52 出处:网络
I\'m new to JSF and have a problem trying to display a subset of data in JSF datatable. Problem description:

I'm new to JSF and have a problem trying to display a subset of data in JSF datatable. Problem description: 1. I have a datable bound to the model like below:

<h:dataTable border="1" cellspa开发者_C百科cing="0" cellpadding="0" id="invoiceLinesUpperDt" styleClass="basic-table" value="#{pc_InvoiceCRMVUpdate.viewBean.showInvoiceLinesInError? pc_InvoiceCRMVUpdate.viewBean.invoice.invoiceLinesInError : pc_InvoiceCRMVUpdate.viewBean.invoice.invoiceLines}" var="invoiceLine">

I have a checkbox that triggers between two datasets like below:

<h:selectBooleanCheckbox id="displayOnlyLinesInErrorCb" immediate="false" value="#{pc_InvoiceCRMVUpdate.viewBean.showInvoiceLinesInError}" onclick="javascript: document.forms['invoiceCRMVUpdateForm'].submit();" valueChangeListener="#{pc_InvoiceCRMVUpdate.displayOnlyLinesInError}"/>
  1. When the full list of data (returned by pc_InvoiceCRMVUpdate.viewBean.invoice.invoiceLines)is displayed there is no problem - I can edit and submit values and get them populated in data model correctly

  2. The problem appears when the subset of data (returned by pc_InvoiceCRMVUpdate.viewBean.invoice.invoiceLinesInError) is displayed. I still can edit the data BUT when I trigger back to full list the data appears in wrong rows. For example if the first row of subset was edited then they appear in the first row of full set and so on.

  3. In the restore view phase the correct data model method is called. So I expect to get values at the correct places in the subset. But I don't get them.

What can be the problem?

Thanks in advance!

Roman.


Found the problem. It was a luck of experience with JSF and stupid mistake.

Just left FacesContext.getCurrentInstance().renderResponse(); inside the value change listener #{pc_InvoiceCRMVUpdate.displayOnlyLinesInError}.

After removed that line of code everything became working!

0

精彩评论

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

关注公众号