Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
2.6k views
in Technique[技术] by (71.8m points)

jsf - Wrong values in <p:rowExpansion> and empty values in <p:cellEditor> on scrolled page when using <p:dataTable lazy="true" liveScroll="true">

I am using JSF 2.2 with PrimeFaces 4.0. I have a <p:dataTable> with live scrolling, lazy loading, row-expansion and cell-editing, etc.

<p:dataTable
    id="dtaTable"
    selection="#{cont.selectedArray}"
    resizableColumns="true"
    draggableColumns="true"
    var="dataModel"
    value="#{cont.yieldBondsModel}"
    editable="true"
    editMode="cell"
    selectionMode="multiple"
    rowSelectMode="add"
    scrollable="true"
    scrollHeight="650"
    rowKey="#{modeld.id}+#{model.name}"
    rowIndexVar="rowIndex"
    filterEvent="enter"
    styleClass="screenScrollStyle"
    scrollRows="25"
    liveScroll="true"
    lazy="true"
    rows="50"
    filteredValue="#{cont.filteredModel}"
    widgetVar="dt4"
>
    <p:rowExpansion>
        <h:panelGrid id="display" columns="2" cellpadding="4" style="width:300px;" styleClass="ui-widget-content grid">
            <f:facet name="header" styleClass="dataTableHeader">Other Data</f:facet>
            <h:outputText value="id " />
            <h:outputText value="#{dataModel.id}"/>
            <h:outputText value="Name" />
            <h:outputText  value="#{dataModel.name}" />
        </h:panelGrid>
    </p:rowExpansion>

    <p:column width="15">
        <p:rowToggler />
    </p:column>

    ...
</p:dataTable>

On the first page everything works like a charm. Once I scroll it down, data is getting lazy-loaded perfectly fine, but it has some problems during row-expansion and cell-editing:

  1. In row-expansion, I am getting wrong values. Maybe overlapped values from other row.

  2. Cell-editing is also not working. Once I edit any cell, values are not getting displayed in cell-editor. I have checked in Firebug, there is no value in <h:outputText> as confirmed by the generated HTML <div class="ui-cell-editor-output" style="display: none;"></div>. As you can see, there is no value inside the div.

The backing bean is @SessionScoped.

How is this caused and how can I solve it?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

This is a known issue on PrimeFaces, and already reported and fixed in Elite version (4.0.7 if I remember well). However community release does not contain this fix yet. There is an RC for PrimeFaces 5.0 which contains this fix. You can download it and test if it's suits for you needs, but be aware that this is only a release candidate, not a final release. AFAIK the ETA for the 5.0 final is the first half of May.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...