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

  • Home
  • SEARCH
  • 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 5928083
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T14:15:07+00:00 2026-05-22T14:15:07+00:00

I have a celltable with the following attributes (feature, Total, Pass, Fail) and I

  • 0

I have a celltable with the following attributes (feature, Total, Pass, Fail) and I have a bunch of rows. I want to add support to sort by feature (which is a text) alphabetically or sort by fail (Integer). Please note that I DON’T want to sort by feature and table both! I want to sort by them individually. How do I achieve this?

One can add Column Sort Handlers using addColumnSortHandler method but this handler gets fired when I select any column that is sortable. If I add more than 1 column sort handler, all comparators get fired. How do I make sure only the data gets sorted with the column I click. i.e. if I click Feature heading, it should get sorted alphabetically. If I click Fail then it should sort by fail.. etc..

Any help would be appreciated. Thank you

Here’s a code snippet

        final ListHandler<FeatureSummaryObject> failedColSortHandler = new ListHandler<FeatureSummaryObject>(dataProvider.getList());
        failedColSortHandler.setComparator(failedCol, new Comparator<FeatureSummaryObject>() {

            @Override
            public int compare(FeatureSummaryObject o1, FeatureSummaryObject o2) {
                return o1.getFailed() - o2.getFailed();
            }
        });
        table.addColumnSortHandler(failedColSortHandler);
        failedCol.setSortable(true);


        ListHandler<FeatureSummaryObject> featureColSortHandler = new ListHandler<FeatureSummaryObject>(dataProvider.getList());
        featureColSortHandler.setComparator(featureCol, new Comparator<FeatureSummaryObject>() {

            @Override
            public int compare(FeatureSummaryObject o1, FeatureSummaryObject o2) {
                return o1.feature.compareTo(o2.feature);
            }
        });
        table.addColumnSortHandler(featureColSortHandler);

        featureCol.setSortable(true);

Regards,

  • 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-22T14:15:08+00:00Added an answer on May 22, 2026 at 2:15 pm

    I’m using a CellTable to display a list of files (File Name, Size, Mime Type). I am able to sort individually by column, when clicking on the header, using the following code:

    First I mark the columns as sortable:

       urlColumn.setSortable(true);
       mimeColumn.setSortable(true);
       sizeColumn.setSortable(true);
    

    Then I add a create a ColumnSortHandler for each column, and add to the table like this:

       // Add sorting for the Name column
       ListHandler<Asset> urlSortHandler = new ListHandler<Asset>(dataProvider.getList());
       urlSortHandler.setComparator(urlColumn, new Comparator<Asset>() {
         public int compare(Asset o1, Asset o2) {
            ....
         }
       });
       table.addColumnSortHandler(urlSortHandler);
    
       // Add sorting for the Size column
       ListHandler<Asset> sizeSortHandler = new ListHandler<Asset>(dataProvider.getList());
       sizeSortHandler.setComparator(sizeColumn, new Comparator<Asset>() {
         public int compare(Asset o1, Asset o2) {
            ....
         }
       });
       table.addColumnSortHandler(sizeSortHandler);
    
       // Add sorting for the Type column
       ListHandler<Asset> mimeSortHandler = new ListHandler<Asset>(dataProvider.getList());
       mimeSortHandler.setComparator(mimeColumn, new Comparator<Asset>() {
          public int compare(Asset o1, Asset o2) {
             ...
          }
       });
       table.addColumnSortHandler(mimeSortHandler);
    

    I added some logging and verified the appropriate sort handlers are being fired (meaning if I click file name, only the file name sort handler is invoked).

    Hopefully this sample code helps. If not, please provide some sample code which might help us to better diagnose the problem

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

Sidebar

Related Questions

I have a GWT CellTable<MyType> . This table have rows which should display a
I have a CellTable where I want to put HTML-code in the cells. The
Have just started using Visual Studio Professional's built-in unit testing features, which as I
Lets say I have the following ruby definition at the topmost level callable =
I have following class hierarchy scenario; Class A has a method and Class B
I have the following code in D import std.stdio; class Thing { // Fields
I have a function that looks like the following, with a whole lot of
I have a CellTable being displayed like shown below- On click of the Delete
I have the following xpath statement in a selenium test: //tbody/tr[td/span[text()='IPODate']]/td[4]/input It gets what
I have the following test code. import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.FutureTask; class MyTask

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.