2

I am using Sencha touch 2 to create a disabled selectfield, populated with default value. The problem is that if I disable the selectfield, then the value is not shown on iOS devices(it is blank and disabled)., but the value is shown properly on other platforms (android,chrome browser). How can I make the value visible? Here's my code for the selectfield.

xtype: 'selectfield',
disabled: true,
id: 'lengthUnit',
label: 'Length unit',
labelWidth: '35%',
labelWrap: true,
name: 'lengthUnit',
options: [
{
text: 'km',
value: 'km'
},
{
text: 'mi',
value: 'mi'
}

The value is set by calling setRecord function on the parent container. The values populate properly if the selectfield is not disabled. This problem occurs only on iOS devices!

Sourabh86
  • 744
  • 10
  • 18

1 Answers1

3

Try using readOnly: true instead of disabled: true.

If you want it to look like it's disabled then add: cls: 'x-item-disabled'

If you are trying to set values or read values from a field is always a good idea not to disable it.

Guilherme Lopes
  • 4,688
  • 1
  • 19
  • 42
  • This works! but any idea why the disabled controls don't show values on ios? Should I raise a bug about this with Sencha? – Sourabh86 Dec 16 '14 at 05:36
  • I think you should test this with the latest version (nightly builds) if you have access and see if this problem still occurs. If yes, open up a bug with Sencha, because if this was the intended behavior, it should act the same way in every browser/OS. – Guilherme Lopes Dec 18 '14 at 18:56
  • changed setDisabled(True); to setReadOnly(True) in iOS field was now visible. Thanks – Hevski Sep 02 '15 at 15:16