how to set dynamically value to the webos IntegerPicker
How do I set value dynamically to开发者_开发知识库 the integerpicker?
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.
精彩评论