1. #1
    Sencha User
    Join Date
    Oct 2012
    Posts
    3
    Vote Rating
    0
    h.martiker is on a distinguished road

      0  

    Default Unanswered: Set Combobox value and display Field by Loading Record in Form

    Unanswered: Set Combobox value and display Field by Loading Record in Form


    Hey everybody,

    I have a Combobox assigned to a DirectStore. When the user inputs some text the Store send a request to the backendserver. Everything works fine so I can select the article from the Store and the value and displayFields gets populated.
    But the Combobox is also member of a Dataform. When I load the model in the form all Fields get populated except the combobox. I think there is only the displayField missing.
    But I checked that the valueField of the combobox will be filled if the article is still an item of the store. (e.g. last Search)

    So is it possible to fill the displayField from the Load-Method of the Form e.g. by creating a model with a displayField and valueField for the Datafield of the article-number?

    PHP Code:
    {
      {
        
    xtype'combobox',
        
    anchor'100%',
        
    listConfig: {
            
    loadingText'Suche nach Artikeln...',
            
    emptyText'Keinen Artikel mit dieser Artikelnummer gefunden!',
            
    getInnerTpl: function() {
              return 
    '<div class="search-item"><b>{artikelnummer}</b><br>{kurztext}</div>';
            }
        },
        
    itemId'artikelnummer',
        
    name'artikelnummer',
        
    fieldLabel'Artikelnummer',
        
    selectOnFocustrue,
        
    hideTriggertrue,
        
    displayField'artikelnummer',
        
    forceSelectiontrue,
        
    minChars2,
        
    queryCachingfalse,
        
    queryDelay50,
        
    queryParam'queryArtikelnummer',
        
    store'Artikelsuche',
        
    typeAheadtrue,
        
    valueField'artikelnummer',
        
    listeners: {
            
    select: {
                
    fnme.onArtikelnummerSelect,
                
    scopeme
            
    }
        }
    }, 

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,074
    Answers
    3500
    Vote Rating
    854
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    If there is no data in the store bound to the combobox, it will only display the value you set on it as it doesn't know of any displayField value to match that value.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

Thread Participants: 1