[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform.rcp] Re: Virtual TableViewer with sort and filter options sample

You can put a sorter and a filter on a virtual TableViewer, but the only 
content that will be sorted or filtered is the currently visible content as 
the table does not know about objects that are not in the view (hence the 
use of the replace(..) method, and the point of a virtual table to begin 
with).

That said, you can certianly sort and filter data even on a virtual table 
(we do it in our implementation), but you'll have to do it "manually" (which 
is nearly the same as using ViewerSorters/ViewerFilters anyway). Basically 
you sort/filter the entire input stack using comparators (or whatever you 
prefer), put the sorted object array back on the table as input and tell it 
how many items there now are and force an update if needed. In our case we 
keep a "original" list and use a "modified" list as root objects for the 
table, the modified list is the sorted/filtered list and is always used as 
table input, whenever the user needs to rever to the original view that is 
not sorted/filtered we copy from the original version. I'm not saying that's 
the ideal implementation, but it works fine. Our table is about 28,000 
entries, and sorting/filtering it is very fast.

As far as that API comment goes, I think it's a bit misleading.

Regards,
Emil

"Nuno" <nuno.esculcas@xxxxxxxxx> wrote in message 
news:g01mq3$bq6$1@xxxxxxxxxxxxxxxxxxxx
> Hello,
>
> I'm implementing a TableViewer that has a ILazyContentProvider that i had 
> implemented. Now i need to add sort capabilities to my TableViewer.
>
> In some forum i read that:
>
> "...Currently only TableViewer (since 3.3) with the VIRTUAL-Bit and a 
> normal content provider can do sorting and filtering..."
>
> I ask if this is true, and if it is, then can anyone point me a sample or 
> some kind of tutorial explaining how this is done.
>
> Thanks
>
> Nuno