Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6207025
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T05:33:19+00:00 2026-05-24T05:33:19+00:00

I’m not sure if this is a bug or just something that isn’t implemented

  • 0

I’m not sure if this is a bug or just something that isn’t implemented but I can’t update the dataGrids page property to reset the pagination to page 1. I’ve bound it to an expression in my bean and update it via an ajax update, but it doesn’t get updated when I clicked my button. The paginator will stay on the selected page and not reset via an ajax request. I’m using to try to reset it. The dreamSearchBean’s setCurrentPage does get called and gets passed 1 but it stays at whatever page was last selected

<h:form id="dreamWebSearchFrm">
<p:commandButton styleClass="form-btn1" value="#{bundle['dreamSearch.search.button.TEXT']}" onclick="trackingDreamSearch()"
        actionListener="#{dreamSearch.search}" update=":dreamWebSearchFrm:resultsPnl">
        <f:setPropertyActionListener value="1" target="#{dreamSearchBean.currentPage}"/>    
</p:commandButton>
<p:panel id="resultsPnl">
                    <div class="data-grid-wrap">
                    <h:outputFormat escape="false" value="#{bundle['dreamSearch.imageResults.TEXT']}" rendered="#{dreamSearchBean.shouldRender}" >
                        <f:param value="#{dreamSearchBean.searchText}" />
                    </h:outputFormat>
                        <p:dataGrid var="dream" value="#{dreamSearchBean.dreams}" rendered="#{dreamSearchBean.shouldRender}" page="#{dreamSearchBean.currentPage}" pageLinks="3"  columns="4" rows="4" paginator="true" effect="true"
                            styleClass="ui-header-visibility"
                            paginatorTemplate="{FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink}"
                            paginatorPosition="bottom">
                            <p:column>
                                <h:panelGrid columns="1">
                                    <p:commandLink onclick="webSearchDlg.hide();dreamEditDlg.show();" update=":dreamEditFrm:display"> 
                                        <f:setPropertyActionListener value="#{dream}" target="#{dreamModifyBean.selectedDream}"/>
                                        <p:graphicImage value="#{dream.imageThumb}" width="125" height="100"></p:graphicImage>
                                    </p:commandLink>
                                </h:panelGrid>
                            </p:column>
                        </p:dataGrid>
                    </div>
                </p:panel>
</h:form>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T05:33:21+00:00Added an answer on May 24, 2026 at 5:33 am

    You have to extend the DataTableRenderer of Primefaces. Create a new class, maybe it could be DataTableRendererExt that extends the DataTableRenderer.

    Override the encodeMarkup(...) method, copy the origin code, and insert a call to resetPagination():

    @Override
    protected void encodeMarkup(FacesContext context, DataTable table) throws IOException{
        ResponseWriter writer = context.getResponseWriter();
       ...
        if(hasPaginator) {
            table.resetPagination();
            table.calculatePage();
        }
    

    To bind this extended class in your application you have to insert this block in your faces-config.xml:

    <render-kit>
        <renderer>
                <component-family>org.primefaces.component</component-family>
                <renderer-type>org.primefaces.component.DataTableRenderer</renderer-type>
                <renderer-class>your.package.DataTableRendererExt</renderer-class>
        </renderer>
    </render-kit>
    

    There is another bug in the DataTableRenderer – lazyLoading. Data table is empty on the very first load because of incorrect placement of table.loadLazyData() in the encodeTbody(...) method.

    Here is my code for the extension class:

    public class DataTableRendererExt extends DataTableRenderer
    {
    
        @Override
        protected void encodeMarkup(FacesContext context, DataTable table) throws IOException{
            ResponseWriter writer = context.getResponseWriter();
            String clientId = table.getClientId(context);
            boolean scrollable = table.isScrollable();
            String containerClass = scrollable ? DataTable.CONTAINER_CLASS + " " + DataTable.SCROLLABLE_CONTAINER_CLASS : DataTable.CONTAINER_CLASS;
            containerClass = table.getStyleClass() != null ? containerClass + " " + table.getStyleClass() : containerClass;
            String style = null;
            boolean hasPaginator = table.isPaginator();
            String paginatorPosition = table.getPaginatorPosition();
    
            if(hasPaginator) {
                table.resetPagination();
                table.calculatePage();
            }
    
            writer.startElement("div", table);
            writer.writeAttribute("id", clientId, "id");
            writer.writeAttribute("class", containerClass, "styleClass");
            if((style = table.getStyle()) != null) {
                writer.writeAttribute("style", style, "style");
            }
    
            encodeFacet(context, table, table.getHeader(), DataTable.HEADER_CLASS);
    
            if(hasPaginator && !paginatorPosition.equalsIgnoreCase("bottom")) {
                encodePaginatorMarkup(context, table, "top");
            }
    
            if(scrollable) {
                encodeScrollableTable(context, table);
    
            } else {
                encodeRegularTable(context, table);
            }
    
            if(hasPaginator && !paginatorPosition.equalsIgnoreCase("top")) {
                encodePaginatorMarkup(context, table, "bottom");
            }
    
            encodeFacet(context, table, table.getFooter(), DataTable.FOOTER_CLASS);
    
            if(table.isSelectionEnabled()) {
                encodeSelectionHolder(context, table);
            }
    
            writer.endElement("div");
        }
    
        /**
         * @see org.primefaces.component.datatable.DataTableRenderer#encodeTbody(javax.faces.context.FacesContext, org.primefaces.component.datatable.DataTable)
         * Fix for lazy load bug: data table is empty on very first load because of wrong palcement of table.loadLazyData();
         */
        @Override
        protected void encodeTbody(FacesContext context, DataTable table) throws IOException {
            ResponseWriter writer = context.getResponseWriter();
            String rowIndexVar = table.getRowIndexVar();
            String clientId = table.getClientId(context);
            String emptyMessage = table.getEmptyMessage();
            String selectionMode = table.getSelectionMode();
            String columnSelectionMode = table.getColumnSelectionMode();
            String selMode = selectionMode != null ? selectionMode : columnSelectionMode != null ? columnSelectionMode : null;
            Object selection = table.getSelection();
    
    
            if(table.isLazy()) {
                table.loadLazyData();
            }
    
            int rows = table.getRows();
            int first = table.getFirst();
            int rowCount = table.getRowCount();
            int rowCountToRender = rows == 0 ? rowCount : rows;
            boolean hasData = rowCount > 0;
    
    
    
            String tbodyClass = hasData ? DataTable.DATA_CLASS : DataTable.EMPTY_DATA_CLASS;
    
            writer.startElement("tbody", null);
            writer.writeAttribute("id", clientId + "_data", null);
            writer.writeAttribute("class", tbodyClass, null);
    
            if(hasData) {
                if(selectionMode != null && selection != null) {
                    handlePreselection(table, selectionMode, selection);
                }
    
                for(int i = first; i < (first + rowCountToRender); i++) {
                    encodeRow(context, table, clientId, i, rowIndexVar);
                }
            }
            else if(emptyMessage != null){
                //Empty message
                writer.startElement("tr", null);
                writer.writeAttribute("class", DataTable.ROW_CLASS, null);
    
                writer.startElement("td", null);
                writer.writeAttribute("colspan", table.getColumns().size(), null);
                writer.write("&nbsp;");
                writer.endElement("td");
    
                writer.endElement("tr");
            }
    
            writer.endElement("tbody");
    
            //Cleanup
            table.setRowIndex(-1);
            if(rowIndexVar != null) {
                context.getExternalContext().getRequestMap().remove(rowIndexVar);
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a jquery bug and I've been looking for hours now, I can't
I have a French site that I want to parse, but am running into
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I need a function that will clean a strings' special characters. I do NOT
Does anyone know how can I replace this 2 symbol below from the string
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I want to count how many characters a certain string has in PHP, but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.