CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2011

    sorting selected checkbox rows to the top of table

    I am working on a project where we using technologies like Java, velocity etc. I am working on a task where I display data by means of a HTML table having 5 columns with 1st column being checkbox selection. I need some help with this - "If the user is going to select checkboxes on 1,3,5 rows then I need to move those selected rows on the top of this table." I am getting a Java Object and looping thru that Java Object in the velocity file using For Loop to display the data in this HTML table. someone advised me using Java comparator I can do this but I dont have much idea about it. Can someone please provide me code for how to do this. I very much appreciate your help.

  2. #2
    Join Date
    Apr 2007

    Re: sorting selected checkbox rows to the top of table

    Comparator is really very simple. It takes two Objects, in your case the checkBoxes, and returns an integer (1, 0, -1). Clearly the result says which one is "greater" or if the two are of equal value. This implementation you will then use with Collections.sort(someList, someComparator ).. and presto.

    What do you not understand of this? We do not know your other existing business logic behind it, so asking someone else to write your code is usually likely to be less than helpfull. Google is your friend, and if that does not help specific questions with code samples describing your issue and implementation is the best way here.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.