I am using JIDE grids for loading huge data tables in a uitable format. My main reason for using JIDE grid was to have a working filtering and sorting ability. There are filter/sorters available out there which can be hooked with old uitable and are easier to configure but most sort lexically rather than numerically. I believe that is due to Matlab's underlying data class.
So far, JIDEs inbuilt filtering is working well and uitable loads even faster than old version of uitable in Matlab when I load neary 500x35 of mixed data type. But there are a few other things that I would like to configure, to which I have found no referent in JIDE documentation.
1) Does anyone knows how to add row number column in JIDE implementation? (just like row number header in old/new uitable configurations). I have tried to use findobj and inspect (by Yair Altman) utility to find them and switch them on but they seems to be completely missing.Or I am missing something!
2) When we select 'custom filter' from the column dropdown and pick 'is' or 'doesn't equal' or 'is greater than' it shows a date selection tab, how can we remove this tab. If that is not possible or difficult, how can I remove these options?
3) Lastly, How can I set the number of decimal places displayed in the grid?
Code to reproduce the issues.
% calling old uitable for performance reasons
f1=figure;
[h_Old,containter] = uitable('v0','data',magic(5),'ColumnNames',{'A','B',...
'C','D','E'},'Position',[5 5 500 400],'Parent',f1);
set(h_Old,'Units','normalized','Editable',false);
% Anotherway: JIDE grids even faster in setting up uitable with huge data
data=num2cell(magic(5));
jtable=com.jidesoft.grid.SortableTable(data,{'A','B','C','D','E'});
theader = com.jidesoft.grid.AutoFilterTableHeader(jtable);
theader.setAutoFilterEnabled(true)
theader.setShowFilterName(true)
theader.setShowFilterIcon(true)
jtable.setTableHeader(theader)
jscroll = javax.swing.JScrollPane(jtable);
f2=figure;
[h_old_2,container_2] = javacomponent(jscroll,[5,5,500,400],f2)
set(container_2,'Units','norm');
Thanks for your time and help.
Answering for the benefit of the other who might face the same problem.
1) JIDE does not have a row header automatically. It can be done via TableScrollPane which is unfortunately a lot of more complicated. A simple workaround is to make first column as row header and giving it a 'Look and Feel' of a row header by making changes to DefaultTableCellRenderer. Code below. I guess this is easily maintainable in the long run.
2) This can be done by defining jtable column class. Still work in progress. Will update my answer soon.
3) Decimal places can be set by writing a simple extension to DefautTableCellRenderer in Java. Compile this to get a class > javaaddpath to this class in matlab > replace DefaultTableCellRenderer with your TableCellRenderer. A sample Java Class is below:
Add this class to Matlab and replace replace DefaultTableCellRenderer with your TableCellRenderer like this.
Hope this help others facing the same issue.