Mojo.Widget.IntegerPicker

Namespace Detail

Overview

The IntegerPicker offers selection of a single integer field. It is one of the simple picker widgets which present their choices as a linear sequence of values that wraps around; when you scroll to the end of the sequence, it simply continues back at the beginning.

Declaration

<div x-mojo-element="IntegerPicker" id="integerpickerId"
  class="integerpickerClass" name="integerpickerName"></div> 

Properties Required Value Description
x-mojo-element Required IntegerPicker Declares the widget as type 'IntegerPicker'.
id Required Any String Identifies the widget element for use when instantiating or rendering.
class Optional Any String There is no default class for IntegerPicker, but you can assign one if you want to apply custom styling.
name Optional Any String Adds a unique name to the IntegerPicker widget; generally used in templates.

Events

this.controller.listen(this.controller.get("integerpickerId"),
  Mojo.Event.propertyChange, this.handleUpdate); 

Event Type Value Event Handling
Mojo.Event.propertyChange event.value or model.time Respond to IntegerPicker value change or model.time

Instantiation

this.controller.setupWidget("integerpickerId",
  this.attributes = {
      label: 'Number',
      modelProperty: 'value',
      min: 0,
      max: 20
  },
  this.model = {
      value: 5
  }
); 

Attribute Properties

Attribute Property Type Required Default Description
label String Optional 'Value' Label displayed for the widget controls.
labelPlacement String Optional Mojo.Widget.labelPlacementLeft Mojo.Widget.labelPlacementRight: places label on right, value on left.
Mojo.Widget.labelPlacementLeft: places label on left, value on right
modelProperty String Optional value Model property name for integer.
min Integer Required none Minimum selection option.
max Integer Required none Maximum selection option.
padNumbers Boolean Optional false Specify whether or not to add padding to single-digit numbers.

Model Properties

Model Property Type Required Default Description
value Integer Required null Initial widget value and updated value after user selection.

Methods

The IntegerPicker widget has no methods.