Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » JFace » CheckboxTableViewer looses Checked State after Filter
CheckboxTableViewer looses Checked State after Filter [message #945473] Mon, 15 October 2012 08:11 Go to next message
Christoph Keimel is currently offline Christoph Keimel
Messages: 335
Registered: December 2010
Location: Germany
Senior Member
Hello

I have a CheckboxTableViewer which checkElements are bound to an EMF EList Property using JFace and EMF Databinding. This works great.

My problem started when I introduced a filter text field, so the user can filter the entries that are displayed in the table. This is implemented by adding a ViewerFilter to the table which filters the entries based on the filter text field input. The table is refreshed when the text in the filter text field changes. This in itself also works as expected.

Unfortunately, if an element is removed from the display by the filter and is then added again (because the filter text has been changed in a way to include the element again), the element looses it's checked state.

I think the problem might be caused, because the checked state is saved in the TreeItem widget which gets removed and later recreated when the filter changes.

My current thinking is that I will probably have to trigger an updateTargets on the DataBindingContext. I don't realy like this approach because the filter implementation does not know anything about the databinding, so it would be nice if I could solve this issue with the viewer api.

Does anyone have an idea of what I could try?

Thanks!
Christoph
Re: CheckboxTableViewer looses Checked State after Filter [message #1170100 is a reply to message #945473] Mon, 04 November 2013 07:06 Go to previous message
Robert K. is currently offline Robert K.
Messages: 14
Registered: July 2009
Junior Member
Just for the records as ran into the same problem:

You need to specify a provider that saves the checked states via viewer.setCheckStateProvider(..).
For getting notified of the checkstate-changes you can register the provider as check-state-listener: viewer.addCheckStateListener(...) and update the internal state of the provider accordingly.
Afterwards your CheckboxTableViewer can be filtered without loosing the checked-states.
Previous Topic:Observable label provider for EMF elements ?
Next Topic:How to initial check elements in a CheckboxTreeviewer
Goto Forum:
  


Current Time: Thu Jul 31 13:51:18 EDT 2014

Powered by FUDForum. Page generated in 0.01530 seconds