def __init__(self): super(ListSelectSingleExample, self).__init__() self.setSpacing(True) # 'Shorthand' constructor - also supports data binding using Containers citySelect = ListSelect('Please select a city', self._cities) citySelect.setRows(7) # perfect length in out case citySelect.setNullSelectionAllowed(False) # user can not 'unselect' citySelect.select('Berlin') # select this by default citySelect.setImmediate(True) # send the change to the server at once # react when the user selects something citySelect.addListener(self, IValueChangeListener) self.addComponent(citySelect)
def __init__(self): super(ListSelectMultipleExample, self).__init__() self.setSpacing(True) l = ListSelect('Please select some cities') for c in self._cities: l.addItem(c) l.setRows(7) l.setNullSelectionAllowed(True) l.setMultiSelect(True) l.setImmediate(True) l.addListener(self, IValueChangeListener) self.addComponent(l)