Column Sort « JTable « Java Swing Q&A





1. Strategy for detecting an object in JTable row?    stackoverflow.com

Here's the thing: a sortable JTable backed by JTableModel with an array of objects that populate rows (one object = one row). Need to delete rows. Without sorting, deleting an object is ...

2. how to sort JTable by providing column index externally    stackoverflow.com

I would like to implement sorting on JTable by providing column index externally in program. Here is my sample code in which i have initialize JTable, Add one Column and 30 ...

3. JTable + sorting column, but row is not sorted    stackoverflow.com

I have created a JTable, the table contains 4 rows, and for a specific row, I have overridden the sorting and its working fine only on that column.

Status  Scheduled Date ...

4. JTable sorting many columns    stackoverflow.com

I need a multi column table sorter. I'm using TableRowSorter and I found something about setSortKeys, but I'm not sure if this what I'm looking for. How can I do multi column sorting ...

5. Exclude column from sorting in JTable    stackoverflow.com

I have a simple Swing JTable and a TableRowSorter made by me. However, I would exclude the first column from the sorting, as I want to keep it to show row ...

6. JTable method called when sorting by column    stackoverflow.com

Is there any method in JTable (or in a related class) that is called when user click on the column header to sort the relative column? I would like to perform some ...

7. Sorting rows by columns in JTable    stackoverflow.com

When you click the column header on my JTable, its sorts the rows alphabetically. This works for all of my columns except for one. In this column the values are all ...

8. Why does my JTable sort an integer column incorrectly?    stackoverflow.com

I have a JTable that uses a DefaultTableModel and I allow for sorting when the user clicks on the column headers. However, when the user clicks on a header for a ...

9. Java JTable Sorting Doesn't Work for Just One Column    stackoverflow.com

In a Java Swing app (built in Netbeans 6.9), I have a JTable with 21 columns. About 14 of those columns consist of double values. The first 6 columns are dates ...





10. sorting a JTable using a data vector    stackoverflow.com

I got stuck with a performance problem while writing my program and I need your help! :) I'm using a JTable to view test results taken from a vector I made and ...

11. sorting columns of a jtable created with Matisse    forums.netbeans.org

hi, I created a JTable with Matisse. I would like to ask if it is a way to sort the columns of this JTable using the property sheet of the JTable that come with Matisse. If it is not possible to do it directly (in that way), I would like to know how I can modify the *guarded* code to insert ...

12. jtable sort on multiple columns    coderanch.com

Hello All, I would like to know if anyone has any full working examples of sorting a jtable on multiple columns. I have the following data items in a table. When the user clicks on the market column, the results should be sorted by market, code,sequence like.. market media code sequence BF TV 7 1 CA LM 2 1 CA LM ...

15. Multi Column Sorting.    coderanch.com

16. Sorting the Rows in a JTable Component Based on a Column    coderanch.com

call sortAllRowsBy method....pass table model,the column by which you want to sort and (ascending or descending) as parameters you will get all rows of jtable sorted based on given column values ...... public void sortAllRowsBy(DefaultTableModel model, int colIndex, boolean ascending) { Vector data = model.getDataVector(); Collections.sort(data, new ColumnSorter(colIndex, ascending)); model.fireTableStructureChanged(); } public class ColumnSorter implements Comparator { int colIndex; boolean ascending; ...





17. JTable set up default auto-sorted column    coderanch.com

Dear community, let me ask you a question: how can I defined column to be auto-sorted? The problem is the following: creating JTable with some columns, set auto sort to true and some other cosmetic stuff. I'm perfectly happy with the result on the screen with the only exception - each time this window appear I need to click on the ...

18. How to update a row in view if i sort a column in my model?    coderanch.com

Hi, Sorry!! I am new to Swing. The terminology that i use it may wrong. I have a window contains 3 columns and 60 rows. If i double click a row then it opens a pop up window and i get a row index. I modified something in my pop-up window. But before i save it, i come to parent window ...

19. java.lang.NumberFormatException when sorting table column    coderanch.com

i'm quite amazed at this exception because: i used the same code in other applications in this very application - and in the same jTable - all other columns sort ok, either being numeric or string values the table is populated ok, the data displays ok, every other column has the sort ok, except for this column this column is similar ...

20. Sort Jtable Column based on two conditions    coderanch.com

Hello, I have Jtable with two columns.One colimn has following values in it: 987.65 PB 987.65 TB 9.87 GB 987.65 MB 98.76 PB 98.76 TB 9.87 PB 9.87 MB 987.65 GB 9.87 TB 98.76 MB 987.65 kB 98.76 kB 9.87 kB 98.76 GB 0.09 kB 0.00 I have requirement where if i click on column header ,i want column to be ...

21. Jface tableviewer multi sort columns    coderanch.com

dear all, i am implementing a tableviewer that is able to sort values depengin on their column order. e.g. column1-column2-columnX sorts the rows first on the values of column 1, then column 2, column.... Therefore i want to use a ColumnViewerSorter, especially the method "int doCompare(Viewer viewer, Object e1, Object e2);" inside this method i want to sort depending on other ...

22. Sorting JTable on more than just the values listed in the columns    java-forums.org

I have a collection of objects that store (among other things) two integer values. I only want to display one of these values. The displayed value will dictate the sort order of the JTable. However, I want to break ties with the other, undisplayed, integer value. I've gone through the trouble of specifying my own Comparator for the TableRowSorter. However, this ...

23. JTable: Disable sorting on one column    java-forums.org

24. How to sort column in JTable    java-forums.org

I want to sort the columns based on the data, for example if the column holds chars the sort should be based on alphabetical order and if the column is of type int the sort is based on ascending or descending. Can any one tell me how to do it or get me the source code for the functionality, any help ...

25. Problem with sorting columns using Jtable    java-forums.org

26. Sorting blank column in jTable    forums.oracle.com

@flounder If what u said is correct then i would need to have 2 comparator for ascending and descending separately. Then my next question would be 1) what is the event handler to handle when i click on the column header so i can set the correct comparator. 2) the code to determine the current sort is "ascending" or "descending"

27. Sort jTable rows by column as Integer value    forums.oracle.com

28. Sort JTable columns except one.    forums.oracle.com