QuickTableFilterField implementation question

This is the forum for JIDE Common Layer which is open sourced at https://github.com/jidesoft/jide-oss. Please note, JIDE technical support doesn't monitor this forum as often as other forums. Please consider subscribe for technical support for JIDE Common Layer so that you can use customer only forum to get a timely response.

Moderator: JIDE Support

Forum rules
Community driven forum for open source JIDE Common Layer. JIDE technical support doesn't monitor this forum as often as other forums. If you only use JIDE Common Layer, please consider subscribing for technical support for JIDE Common Layer so that you can use customer only forum to get a timely response.

QuickTableFilterField implementation question

Postby rizwanrafique » Thu Sep 17, 2009 6:03 am

I have a SortableTable with MyTableModel and a QuickTableFilterField. Adding as follows...
Code: Select all
      MyTableModel tableModel = new MyTableModel(someData);
                SortableTable table = new SortableTable();
      QuickTableFilterField filterField = new QuickTableFilterField();
      filterField.setTableModel(tableModel);
      filterField.setTable(table);
      filterField.setColumnIndices(new int[] {0});
      
      table.setModel(filterField.getDisplayTableModel());


Filters are added and work fine.

The problem:
I capture mouse events (mouseRelease) that needs a column and row number to get data from underlying model. When using filters the column and rows that are returned are of the final table that is displayed. For example, I have 10 rows in table and only rows 5 and 6 are displayed after filtering data. Their row number in table is naturally 0 and 1 (as there are now only two rows on the table). When clicking on any of the rows I want their correct number (5 or 6) in my MouseEvent. This gets even trickier when table is sorted.

I get rows in mouseReleased using following code:
Code: Select all
       int tableRow = table.originalRowAtPoint(event.getPoint());
      int actualRow = table.getActualRowAt(tableRow);


Any ideas?
rizwanrafique
 
Posts: 12
Joined: Wed Aug 12, 2009 8:10 am

Re: QuickTableFilterField implementation question

Postby rizwanrafique » Thu Sep 17, 2009 6:19 am

No worries. Solved. Posted too soon I guess.

This helped:

Code: Select all
   int actualRow = table.getActualRowAt(table.originalRowAtPoint(event.getPoint()));

   FilterableTableModel filterable = (FilterableTableModel) tilterField.getDisplayTableModel();
   actualRow = filterable.getActualRowAt(actualRow);
rizwanrafique
 
Posts: 12
Joined: Wed Aug 12, 2009 8:10 am

Re: QuickTableFilterField implementation question

Postby JIDE Support » Thu Sep 17, 2009 7:46 am

Actually, I recommend you to use methods in TableModelWrapperUtils to do the row conversion.

Thanks,
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37219
Joined: Sun Sep 14, 2003 10:49 am


Return to JIDE Common Layer Open Source Project Discussion (Community Driven)

Who is online

Users browsing this forum: Google [Bot] and 70 guests