Question

How do I set value dynamically to the integerpicker?

Was it helpful?

Solution

First insert a interpicker to your html scene:

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

Then instantiate the picker in the Scene-assistant.js file in the setup function:

MainSceneAssistant.prototype.setup = function() {

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

             },
             this.integerPickerModel = {
                 value: 5
             });}

You can than change the picker dynamically by setting the model:

this.integerPickerModel.value = 10;
this.controller.modelChanged(this.integerPickerModel, this);

This works for the most widgets in webos, like pickers and textfields.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top