user3052613
user3052613

Reputation: 31

t:dataScroller variables not updating when t:datascroller is before t:dataTable

t:dataScroller variables not updating when t:datascroller is before t:dataTable

I've spent some time looking for an answer here as well as other sites, but haven't come across anyone else with the same problem, let alone suggested answers.

I understand myfaces t:datascroller is equally functional whether it is placed before or after t:datatable in facelets, as long as the 'for' attribute is set to the datatable id. I have a commandLink that causes a search criteria to be to be posted, resulting in a revised dataset populating the datatable. The datatable itself gets updated correctly everytime a different search criteria is sent by the commandLink. When the t:datascroller is placed after the datatable in the markup, the scroller gets updated correctly everytime. But not when it is placed before the datatable, in which case it requires two clicks of the commandLink, basically a refresh; then the scroller (scroller 2 here) values (pageCountVar,pageIndexVar) are one step behind the displayed datatable. The scroller is showing the variables for the previous search results.

Not being a JSF2 expert, a few things that I've tried unsuccessfully are 1. true and false for the immediate= for scroller and datatable 2. forceId=, setting this to true on the scroller causes the goToLast element button to stop working, so removed it 3. had the datascroller and the datatable as children of the same panelGroup 4. tried $ instead of # for all the datascroller variables 5. fully qualifying the values for the 'for=' attributes 6. tried commandButton, as well as commandLink for triggering the post

I'm running tomahawk21 1.1.14 + mojarra 2.1.6 in Tomcat 7.0.47.

Any help is greatly appreciated here.

    <div id="my_datatable_div">

        <div id="scroll2_div">
            <h:panelGroup rendered="${!myData.hasRows}">No folders found.</h:panelGroup>
            <t:dataScroller id="scroll_2"
              for="my_datatable"
              style="margin:auto;padding:0;border:10px solid #ff0000;"
              rowsCountVar="rowsCount"
              displayedRowsCountVar="displayedRowsCountVar"
              firstRowIndexVar="firstRowIndex"
              lastRowIndexVar="lastRowIndex"
              pageCountVar="pageCount"
              immediate="false"
              pageIndexVar="pageIndex"
              rendered="${myData.hasRows}"
              >
              <h:outputFormat value="Filtered :{0}, showing {1}: from {2} to {3}, Page {4}/{5}.">
                <f:param value="#{rowsCount}" />
                <f:param value="#{displayedRowsCountVar}" />
                <f:param value="#{firstRowIndex}" />
                <f:param value="#{lastRowIndex}" />
                <f:param value="#{pageIndex}" />
                <f:param value="#{pageCount}" />
              </h:outputFormat>
            </t:dataScroller>
        </div>
        <div id="scroll1_div">
            <t:dataScroller id="scroll_1"
              styleClass="scroller1Style"
              paginatorTableStyle="scroll1PaginatorTableStyle"
              paginatorColumnClass="scoller1PaginatorColumnClass"
              paginatorActiveColumnClass="scroller1PaginatorActiveColumnClass"
              for="my_datatable"
              fastStep="10"
              pageCountVar="pageCount"
              pageIndexVar="pageIndex"
              paginator="true"
              paginatorMaxPages="9"
              paginatorTableClass="paginator"
              paginatorActiveColumnStyle="font-weight:bold;"
              rendered="${myData.shouldShowPaginator}"
              immediate="false">

              <f:ajax execute="my_datatable scroll_2 scroll_1" render="my_datatable scroll_2 scroll_1 "/>

              <f:facet name="first" >
                  <h:graphicImage style="border:0;margin-right:15px;" library="icons20121211" name="Beginning-16x16.png" />
              </f:facet>
              <f:facet name="last">
                  <h:graphicImage style="border:0;margin-right:0;" library="icons20121211" name="Last-16x16.png" />
              </f:facet>
              <f:facet name="previous">
                  <h:graphicImage style="border:0;margin-right:15px;" library="icons20121211" name="Previous-16x16.png" />
              </f:facet>
              <f:facet name="next">
                  <h:graphicImage style="border:0;margin-right:15px;margin-left:15px;" library="icons20121211" name="Next-16x16.png" />
              </f:facet>
              <f:facet name="fastforward">
                  <h:graphicImage style="border:0;margin-right:15px;" library="icons20121211" name="FastForward-16x16.png" />
              </f:facet>
              <f:facet name="fastrewind">
                  <h:graphicImage style="border:0;margin-right:15px;" library="icons20121211" name="FastRewind-16x16.png" />
              </f:facet>
            </t:dataScroller>
        </div>
          <t:dataTable id="my_datatable"  forceId="true"

              immediate="true"

              styleClass="my_datatable_style"
              headerClass="standardTable_Header"
              footerClass="standardTable_Header"
              rowClasses="standardTableRowClass"
              rowOnMouseOver="this.style.backgroundColor='#FAFF67'"
              rowOnMouseOut="this.style.backgroundColor='#F5F5F5'"
              rowOnClick="this.style.backgroundColor='#FFE0E0'"

              var="dataItem"
              value="#{myData.list}"
              first="#{myData.firstRowIndex}"
              preserveDataModel="false"
              rows="#{myData.rowCount}">

              <t:column styleClass="${myData.columnStyleFor(dataItem)}">
               .....
              </t:column>

        </t:dataTable>

    </div>

Upvotes: 1

Views: 808

Answers (0)

Related Questions