Results 1 to 4 of 4

Thread: ComboBox Select item by DisplayField-value

  1. #1
    Sencha User
    Join Date
    Jun 2012
    Posts
    48
    Answers
    7

    Default Answered: ComboBox Select item by DisplayField-value

    Hi, is it possible to select an item of a combobox by displayfield-value?

    There ist a combobox combined with a store. Store/Modell has two columns. --> valuefield and displayfield of combo. Store`s data is persistent (mysql db). Now i want to add some data to combobox/store. But i don`t want to write the data into database (not at that time). So i set valuefield of the new record to 0. Later i can recognize, which records have to be written to database. I also want to select the new item. This works fine, if i only add one new item. Has valueField to be unique? How to select item by displayField?

    // the combobox is part of a workflow. At the end its 50/50 not to save the data. I don`t want to build a kind of transaction rollback stuff.

  2. Try something like this:

    http://jsfiddle.net/EmilPennlov/z9tLn/2/

    Good luck / E

  3. #2
    Sencha Premium Member EPV's Avatar
    Join Date
    Dec 2010
    Location
    Sweden
    Posts
    361
    Answers
    37

    Default

    Try something like this:

    http://jsfiddle.net/EmilPennlov/z9tLn/2/

    Good luck / E

  4. #3
    Sencha User
    Join Date
    Jun 2012
    Posts
    48
    Answers
    7

    Default

    Thank you EPV. Good solution, works as wanted.

    // first time i recognize jsfiddle supports frameworks.

  5. #4
    Sencha User metalinspired's Avatar
    Join Date
    Apr 2012
    Posts
    98
    Answers
    4

    Default

    Also, if you haven't set your store's autoSync to true it will not save it's data to DB unless you call sync() method.
    This allows you to manipulate store locally and when you're satisfied with the way things are simply sync the store.

Posting Permissions

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