When creating a domino-ui horizontal spin select like the following
HSpinSelect<Long>spRepeat = HSpinSelect.create();
Is there a way to make it infinite? so the user can keep clicking on next and get a new long value every time without a limit.
When creating a domino-ui horizontal spin select like the following
HSpinSelect<Long>spRepeat = HSpinSelect.create();
Is there a way to make it infinite? so the user can keep clicking on next and get a new long value every time without a limit.
What you can do in this case is starting with some number of long elements that is greater than 1, then you can add a selectionHandler that will check if you are about to hit the limit then you add more spin items.
HSpinSelect<Long> spin = HSpinSelect.create();
LongStream.range(0, 10).forEach(value -> {
spin.appendChild(SpinItem.create(value, Elements.div().textContent(String.valueOf(value)).element()));
});
spin.addSelectionHandler(selectedItem -> {
long lastValue = spin.getItems().get(spin.getItems().size() - 1).getValue();
if(selectedItem.getValue() < (lastValue - 2)){
LongStream.range(lastValue+1, lastValue+10).forEach(value -> {
spin.appendChild(SpinItem.create(value, Elements.div().textContent(String.valueOf(value)).element()));
});
}
});