Filter preferences on a table not working with Integers

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.

Filter preferences on a table not working with Integers

Postby vidhut » Tue Jul 08, 2014 5:34 pm

Hi,

I am having issues where the table is not saving the filter preferences when i do a save preferences. This happens only on integers or a number field, however it works perfectly with strings
The steps to repo this issue is run the attached class
1.Filter on # of year and pick any number
2.save the preference
3.now change the filter to "ALL"
4.click Load
The data is not displayed in the table.

I am attaching a copy of my test case.
filterTest.java
(5 KiB) Downloaded 1819 times


This seems to be a bug in the Library as i was able to reproduce the same on FilterableTableDemo.java on jide demos.

Anyone experiencing this issue too?
Would appreciate any help on this.

Thanks
vidhut
 
Posts: 2
Joined: Fri Jun 13, 2014 3:39 pm

Re: Filter preferences on a table not working with Integers

Postby JIDE Support » Tue Jul 08, 2014 9:30 pm

You will have to return the correct data type at the getColumnClass correctly. It is very important to implement this method if using the JIDE Grids. We don't depend on the actual data to determine the data type as the table could be empty but depending on the getColumnClass or sometimes getCellClassAt of the ContextSensitiveTableModel to determine the data type.

Code: Select all
        TableModel model = new DefaultTableModel(data, columnNames) {
            @Override
            public Class<?> getColumnClass(int columnIndex) {
                if(columnIndex == 3) return Integer.class;
                else if (columnIndex == 4) return Boolean.class;
                return super.getColumnClass(columnIndex);
            }
        };
        final JTable table = new JTable(model);
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: No registered users and 7 guests

cron