Skip to content

JavaScript Picker

Considering the example below:

<html>
<script src="https://jsuites.net/v4/jsuites.js"></script>
<link rel="stylesheet" href="https://jsuites.net/v4/jsuites.css" type="text/css" />

<div id="picker"></div>

<script>
  var picker = jSuites.picker(document.getElementById('picker'), {
    data: [ 'Verdana', 'Arial', 'Courier New' ],
    value: 1,
    content: 'format_size',
  })
</script>
</html>
MethodDescription
picker.getLabel(int);Return the option at the specified position
@param - element index
picker.open();Open the picker
picker.close();Closes the picker
picker.getValue();Returns the index corresponding to the current selected element
picker.setValue(int);Define the option at the specified position as the picker value

The order of the onchange methods has changed from 4.2.0

MethodDescription
onchangeWhen the value is changed
onchange(DOMElement element, Object instance, String value, String value, Number selectIndex) => void
oncloseWhen the picker is closed
onclose(DOMElement element, Object instance) => void
onopenWhen the picker is open
onopen(DOMElement element, Object instance) => void
PropertyDescription
data: string[]The picker options.
value: intThe position of the initial picker option.
content: stringThe html or material-design icon that should be in front of the picker.
width: numberThe picker width.
render: functionHow each option should be shown.
function(string option) => string