TwinSelectOrderedColumns
Sortable Twin Column Select
Vaadin TwinColSelect lacks the ability to sort the order of the result. This component allows the user to do so.
Enhancements:
- Able to set ID and caption are separately
Sample code
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package com.dragonzone.vaadin; import com.dragonzone.vaadin.utils.TwinSelectOrderedColumns; import com.dragonzone.vaadin.utils.TwinSelectOrderedColumnsItem; import com.vaadin.ui.Button; import com.vaadin.ui.Button.ClickEvent; import com.vaadin.ui.Window; import java.util.ArrayList; import java.util.List; /** * * @author dolc */ public class WindowTwinSelectColumns extends Window { private static final String[] LETTERS = new String[]{"A", "B", "C", "D", "E", "F"}; private static final String[] LETTER_IDS = new String[]{"ID_A", "ID_B", "ID_C", "ID_D", "ID_E", "ID_F"}; @Override public void attach() { super.attach(); // Must call in order to use the getApplication() setModal(true); setWidth("90%"); setHeight("90%"); List<TwinSelectOrderedColumnsItem> list = new ArrayList<TwinSelectOrderedColumnsItem>(); for (int i = 0; i < LETTERS.length; i++) { TwinSelectOrderedColumnsItem item = new TwinSelectOrderedColumnsItem(LETTER_IDS[i], LETTERS[i]); list.add(item); } List<TwinSelectOrderedColumnsItem> list2 = new ArrayList<TwinSelectOrderedColumnsItem>(); list2.add(new TwinSelectOrderedColumnsItem("ID_Z", "Z")); final TwinSelectOrderedColumns tsoc = new TwinSelectOrderedColumns(null, list, null, list2); addComponent(tsoc); Button bView = new Button("View Selected"); bView.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { StringBuilder sb = new StringBuilder("VALUES: "); for (TwinSelectOrderedColumnsItem item : tsoc.getSelectedList()) { sb.append(item.getCaption() + " [" + item.getId() + "]"); sb.append(", "); } Notification n = new Notification( sb.toString(), Notification.TYPE_WARNING_MESSAGE); n.setDelayMsec(-1); getApplication().getMainWindow().showNotification(n); } }); addComponent(bView); } }
Links
Compatibility
Was this helpful? Need more help?
Leave a comment or a question below. You can also join
the chat on Discord or
ask questions on StackOverflow.
Version
Enhancements:
- Able to set ID and caption are separately
- Released
- 2011-10-19
- Maturity
- STABLE
- License
- Apache License 2.0
Compatibility
- Framework
- Vaadin 6.0+
- Browser
- Internet Explorer
- Firefox
TwinSelectOrderedColumns - Vaadin Add-on Directory
Sortable Twin Column SelectVaadin TwinColSelect lacks the ability to sort the order of the result. This component allows the user to do so.
Enhancements:
- Able to set ID and caption are separately
TwinSelectOrderedColumns version 0.1.0
null
TwinSelectOrderedColumns version 0.2.0
Enhancements:
- Able to set ID and caption are separately