Results 1 to 4 of 4

Thread: Correct syntax to set combobox default value

  1. #1
    Sencha Premium User
    Join Date
    Sep 2011
    Location
    Tamworth, NSW, Australia
    Posts
    1,353

    Question Correct syntax to set combobox default value

    What's the correct syntax for setting the default value for a combobox? I want it to be the letter "C" so I have tried it in single quotes 'C', with double quotes "C", and without quotes, yet Sencha still highlights the value row in the config inspector with a red margin and the code view has a red circle beside the offending line saying: "Invalid value, config value converted to string". The docs just say an "object", so I even tried putting braces around it like so: { 'C' }, but this doesn't make SA happy, either.

    'C' still works but this has always annoying me, so I'd like to know the correct way.

    Thanks.

  2. #2
    Sencha User
    Join Date
    Jan 2009
    Location
    Frederick, Maryland
    Posts
    925

    Default

    Quote Originally Posted by marc.fearby View Post
    What's the correct syntax for setting the default value for a combobox? I want it to be the letter "C" so I have tried it in single quotes 'C', with double quotes "C", and without quotes, yet Sencha still highlights the value row in the config inspector with a red margin and the code view has a red circle beside the offending line saying: "Invalid value, config value converted to string". The docs just say an "object", so I even tried putting braces around it like so: { 'C' }, but this doesn't make SA happy, either.

    'C' still works but this has always annoying me, so I'd like to know the correct way.

    Thanks.
    We should probably be allowing for an optional config type for that actually. For now, what you're doing is as good as it gets unless you want to use the setValue method after some type of event occurs.
    Jason Minnick
    Sencha Architect Development Team

  3. #3
    Sencha Premium User
    Join Date
    Sep 2011
    Location
    Tamworth, NSW, Australia
    Posts
    1,353

    Default

    I took a wild guess yesterday and entered an array in the config value and it's very happy now -i.e., [ 'C' ]

    Docs don't say array but it both works and shuts SA up :-)

  4. #4
    Sencha User
    Join Date
    Jan 2009
    Location
    Frederick, Maryland
    Posts
    925

    Default

    Quote Originally Posted by marc.fearby View Post
    I took a wild guess yesterday and entered an array in the config value and it's very happy now -i.e., [ 'C' ]

    Docs don't say array but it both works and shuts SA up :-)
    If nothing else; docs should include a string, object and a number. Look for this to be improved in SA 3.
    Jason Minnick
    Sencha Architect Development Team

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •