sorting selected checkbox rows to the top of table
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: sorting selected checkbox rows to the top of table

  1. #1
    Join Date
    Apr 2011
    Posts
    1

    sorting selected checkbox rows to the top of table

    Hi
    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.
    Thanks

  2. #2
    Join Date
    Apr 2007
    Posts
    442

    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
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center