Basically, it works almost as core’s TwinColSelect component, except that you can filter either unselected or selected values. Also, I’ve added shortcut buttons for selecting/deselecting all selections. Check it out!
Hi Kim,
Really like your selector - very cool!
I’m using a derived ‘base’ Theme, not reindeer et al, and the middle buttons are a bit too large for the area between the list boxes (about a typical margin’s worth gets cutoff on the buttons).
Looks like the CSS for the buttons might be tied to a Theme?
I don’t know if there’s way/or how to set a different Theme just for this component. Any ideas how to get the CSS looking right?
Thanks!
Peter
Hi Kim,
I managed to fix this by changing the initializeButtons() and createButton() methods.
Because they’re currently private, I had to re-create the source in an new class.
If these and maybe a few others were made protected, it would be easy to make things look good across any theme.
I just tried to use it, but have no success with set/get the values.
My basic problem is that it does not show the selected values in the right column when I do a setValue(…)
Replacing the component with the original TwinColSelect and it works as expected…
Looking at your code, it seems to be missing a setValue(…) method handling the two columns
I just found out, why selected values are not shown in the ‘selected’ ListSelect.
The container sources for the two ListSelects are setup in the ’ initContent()’ routine, which is called onAttach() (I suppose). This means, selecting items when the Component is not yet attached will have no effect…
I fixed it by putting the assignment of the Containers for the ListSelects into the constructor…
public FilterableTwinColSelect() {
unselectedContainer.addContainerProperty("caption", Object.class, null);
selectedContainer.addContainerProperty("caption", Object.class, null);
setValue(new HashSet<Object>(), false);
layout = new HorizontalLayout();
layout.setSizeFull();
setWidth("300px");
setHeight("200px");
// setup the containerdatasource here
unselected.setContainerDataSource(unselectedContainer);
selected.setContainerDataSource(selectedContainer);
}
Thanks for the add-on it works well but I did notice one difference from the original TwinColSelect. When moving values from the unselected to the selected lists or from selected back to unselected the original TwinColSelect reorded the elements whereas the FilterableTwinColSelect just puts them at the bottom without reordering them. Is there a way to get the lists to resort?