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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T15:56:48+00:00 2026-06-01T15:56:48+00:00

I have a problem with Ajaxfallbacktable – the pagenation is working fine – the

  • 0

I have a problem with Ajaxfallbacktable –
the pagenation is working fine – the data loading – everything is easy as pie –
even the default sorting works – but I can’t figure out how to add updown buttons in every column – so that I can sort the table anyway I want
Here is my table

List<IColumn<logParsed>> columns = new ArrayList<IColumn<logParsed>>();

columns.add(new PropertyColumn<logParsed>(new Model<String>("Number of Entries"), "numberOfEntries") {
    @Override
    public String getCssClass()
    {
        return "numeric";
    }
});
columns.add(new PropertyColumn<logParsed>(new Model<String>("Last Seen"), "lastSeen"));
columns.add(new PropertyColumn<logParsed>(new Model<String>("Host Name"), "hostName") {
    @Override
    public String getCssClass()
    {
        return "hostname";
    }
});
columns.add(new PropertyColumn<logParsed>(new Model<String>("Log Message"), "logMessage"));


logProvider<logParsed> LogProvider = new logProvider<logParsed>(logParsedDao.findAll());
final AjaxFallbackDefaultDataTable<logParsed> dataTable = new AjaxFallbackDefaultDataTable<logParsed>("table", columns, 
        LogProvider, 10) {
    /**
     * 
     */
    private static final long serialVersionUID = 1L;

    @Override
    protected Item<logParsed> newRowItem(String id, int index, IModel<logParsed> model) {
        return new OddEvenItem<logParsed>(id, index, model);
    }
};

/* add(new OrderByBorder("sortByHighest", "numberOfEntries", LogProvider)
{
    private static final long serialVersionUID = 1L;

    @Override
    protected void onSortChanged()
    {
       dataTable.setCurrentPage(0);
    }
}); */
add(dataTable);

Here is my dataprovider:

public class LogProvider<logParsed> extends SortableDataProvider{

/**
 * 
 */
private static final long serialVersionUID = 1L;
private LogParsedDao logParsedDao;





private List<logParsed> list =  new ArrayList<logParsed>();

public LogProvider(List<logParsed> sentList){

    setSort("numberOfEntries",SortOrder.DESCENDING);
    list = sentList;
}

public Iterator iterator(int first, int count) {

    //ArrayList<logParsed> newList = (ArrayList<logParsed>) logParsedDao.findAll();
    //Collections.sort(newList, comparator);
    Iterator<logParsed> iterator = null;

    try {
        if(getSort() != null) {
            Collections.sort(list, new Comparator<logParsed>() {
                private static final long serialVersionUID = 1L;

                    public int compare(logParsed sl1, logParsed sl2) {
                     int result=1;
                        PropertyModel<Comparable> model1= new PropertyModel<Comparable>(sl1, getSort().getProperty());
                        PropertyModel<Comparable> model2= new PropertyModel<Comparable>(sl2, getSort().getProperty());

                        if(model1.getObject() == null && model2.getObject() == null) 
                            result = 0;
                        else if(model1.getObject() == null) 
                            result = 1;
                        else if(model2.getObject() == null) 
                            result = -1;
                        else 
                            result = ((Comparable)model1.getObject()).compareTo(model2.getObject());

                        result = getSort().isAscending() ? result : -result;

                        return result;
                }
            });
        }

        if (list.size() > (first+count))
            iterator = list.subList(first, first+count).iterator();
        else
            iterator = list.iterator();
    } 
    catch (Exception e) {
        e.printStackTrace();
    }

    return iterator;

}

public int size() {
    // TODO Auto-generated method stub
    return list.size();
}

public IModel model(final Object object) {
    return new AbstractReadOnlyModel<logParsed>() {
        @Override
        public logParsed getObject() {
            return (logParsed) object;
        }
    };
}

}
  • 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-01T15:56:49+00:00Added an answer on June 1, 2026 at 3:56 pm

    Use the PropertyColumn constructor that receives the sort property: PropertyColumn(displayModel, sortProperty, propertyExpression).

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

Sidebar

Related Questions

I have problem with pointers. This is working fine - int main(void){ char *w;
i have problem to correctly bind data to WPF Chart. When i'm setting ItemsSource
Have problem while getting data from Memcached on .NET MVC solution. I have this
I have problem when I try insert some data to Informix TEXT column via
I have problem with encoding data in Oracle database. I want to xor string
I have problem to update user data in cakephp. When I submit form I
I have problem with loading my jqGrid. It just loads two parallel lines, and
I have problem with $_POST data. Some fields are missing from input form when
I have problem creating new instance of excel 2007 using VBA (from Access 2002).
I have problem with fancybox. I want to write a function that will run

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.