Results 1 to 2 of 2

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

  1. #1
    Sencha User
    Join Date
    Oct 2012
    Posts
    3
    Vote Rating
    0
      0  

    Default 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 - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,866
    Answers
    3969
    Vote Rating
    1324
      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 @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

Posting Permissions

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