How to stop re fetching of data in JFace TableViewer during column sorting

26 views Asked by At

I have a TableViewer where in i'm setting the data through ContentProvider and LabelProvider i.e

tableViewer.setContentProvider(new SampleTableContentProvider());
tableViewer.setLabelProvider(new SampleTableLabelProvider());
tableViewer.setInput(parent);

I have overriden the getElements() of TableContentProvider to get the children to be stored in the table based on the parent set.

I have sorting the data by overriding doCompare() of ViewerComparator class.

So when i press the table column Header to sort a column , the getElements() of SampleTableContentProvider gets called again which is taking a lot of time to re fetch the data.

Is there any way to avoid this refetching of data while sorting table columns?

0

There are 0 answers