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 7719763
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T03:29:50+00:00 2026-06-01T03:29:50+00:00

On a JSF page for viewing data, I’ve an OpenFaces datatable with sorting and

  • 0

On a JSF page for viewing data, I’ve an OpenFaces datatable with sorting and column reordering enabled saved to appropriate backing bean properties (via: sortColumnId, sortAscending, columnsOrder attributes on the o:dataTable element). On a corresponding inline edit page (where through custom code individual lines of the table can be saved one at a time by the user), the columnsOrder of the datatable is linked to the same property so the columns appear in the same order as on the view page, but the o:columnReordering element is not present in the datatable to prevent column reordering on the edit page. This is required because the AJAX call initiated by moving column fails, due to an error in the partial response XML, to update the table. (There are other requirements too which mean the table should be prevented from being updated via AJAX on the edit page.)

I want to be able to have the datatable on the edit page sorted in the same order as on the view page but with sorting disabled too. However, this doesn’t seem possible in OpenFaces. I’ve linked the datable on the edit page to the same backing bean properties, but for the sorted column to display as sorted, the o:column tag needs to have a sortingExpression attribute. When that attribute is added to the column, that column becomes sortable by the user being able to click on the column header. When not added, the column is not sortable by the user but the table is also not sorted by that column even though it’s specified in the backing bean property as being the column to sort by.

Using JavaScript run by JQuery once the DOM has been created, I’ve tried overwriting the function called by the click event on the ‘th’ element of the OpenFaces column header but after calling the function, the AJAX call to sort and refresh the table is still called. The code used is:

in Edit.xhtml:

<script type="text/javascript">
    $(document).ready(function() {
        $('#doorNumberColumnHeader').parents('th').onclick = null;
        $('#doorNumberColumnHeader').parents('th').click(function(event) {
            alert("Preventing AJAX call");

            if (event) {
                event.preventDefault ? event.preventDefault() : event.returnValue = false;
            }

            return false;
          });
      });
</script>

within OpenFaces datatable of Edit.xthml:

<o:column id="doorNumberColumn" sortingExpression="#{submission.doorNum}" fixed="true" width="50px">
    <f:facet name="header">
        <h:outputText value="#{bundle.SubmissionDoorNumber}" id="doorNumberColumnHeader"/>
    </f:facet>
    <h:outputText value="#{submission.doorNum}"/>
</o:column>

Is there a better way of attempting to prevent the AJAX call to stop the user being able to change the sort order of the table?

Thanks.

  • 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-06-01T03:29:52+00:00Added an answer on June 1, 2026 at 3:29 am

    For those who may be interested, I found the answer to my question was to overwrite the OpenFaces JavaScript _reload() function after the DOM has been created. I understand this may prevent any OpenFaces component on the same page from making AJAX calls (although on the page in question I only have the one datatable so that’s not a problem.)

    <script type="text/javascript">
        $(document).ready(function() {
            // Prevent OpenFaces datatable component from sending AJAX requests!
            window.OpenFaces.Ajax._reload = function(one, two, three) {
                // Do nothing!
            };
        });
    </script>
    

    This solution does not prevent other AJAX calls from being made within the page so an a4j:commandButton can still be used.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am calling a function in a backing bean, but before rendering jsf page,
How do you get the request URL in a bean backing a JSF page?
I have jsf page: .... <form jsfc=h:form action=> <h:dataTable value=#{newMusician.strings} var=preferredMusicGenre id=musicGenresSelectTable> <h:column> <h:inputText
As part of a dataTable in a seam JSF page, one column requires the
I want to implement this JSF page with pagination and sorting. Unfortunately Netbeans shows
I want to pass data from database to JSF page as a table. I
I have a jsf page having a request scope bean. A slow database query
I have a JSF page that has a property datatable a.k.a p:dataTable I need
Imagine a JSF page with several components such as <h:selectOneMenu> , <h:dataTable> , <h:panelGrid>
I would like to add buttons dynamically from a backing bean to a JSF

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.