Ext.field.Spinner.setValue() problem on Android 4.0.3 default browser
Hi,
I have built a custom slider field, that is constructed by a 'spinner' and a 'slider'. Both are capable of changing the spinner's value (the range is 0-2, where the increment is set to 0.1):
https://surf-space.com/tests/customslider/
Every 'change' event on the slider, calls the spinner's setValue() function and modify it.
Problem is, on Android 4.0.3 native browser, most of the spinner's setValue() calls are being "stuck" or "delayed". That is, the change is not being rendered on the view.
So, for example, if the spinner and the slider are both set to 1, and I now drag the slider to 1.5, the spinner's shown value will remain 1. At this state I see 2 unexpected behaviors:
1. Dragging the slider to a new value, say 1.8, will change the spinner's shown value to 1.5 (the next chage will make it 1.8 and so on).
2. Pressing the spinner '+' button will increment the 1.5 (not the shown value 1) by 0.1, resulting 1.6 spinner value.
It seems like the value is changes but not rendered. Is there a way of explicitly calling the spinner's rendering mechanism?
Attached below is my view's code.
Regards, Roei.
Code:
Ext.define('Surfspace.view.ReportPost', { extend: 'Ext.form.Panel',
xtype: 'reportPost',
fullscreen: true,
config: {
styleHtmlContent:true,
items: [
{
xtype: 'fieldset',
title: 'Surf Report',
items: [
{
xtype: 'spinnerfield',
label: 'Wave height',
id: 'waveheightspinner',
minValue: 0,
maxValue: 2,
increment: 0.1,
cycle: false,
component: { type: 'text'},
applyValue: function(newValue, oldValue){
console.log('newValue: ' + newValue + ' oldValue: ' + oldValue);
var waveheighslider = Ext.getCmp("waveheighslider");
// sometimes the slider and the spinner's value are x.x999999999 or x.x00000000001, so this is a quick fix for that.
var sliderval = Math.round(waveheighslider._value[0] * 10)/10;
newValue = Math.round(newValue * 10)/10;
if (sliderval !== newValue) {
console.log('change was done by spinner');
waveheighslider.setValue(newValue);
}
return newValue;
},
},
Ext.create('Ext.Panel', {
layout: 'hbox',
items: [
{
xtype: 'slider',
id: 'waveheighslider',
value: 0,
minValue: 0,
maxValue: 2,
increment: 0.1,
margin: '1%',
flex: 9,
listeners: {
change: function(me, thumb, newValue, oldValue, eOpts) {
var val = Math.round(newValue * 10)/10;
var waveheightspinner = Ext.getCmp("waveheightspinner").setValue(val);
},
}
},]}),
]
},
],
}
});