Results 1 to 5 of 5

Thread: Problem reading values in XTemplate for a Combobox with an static Array as store)

  1. #1
    Sencha User Zerogiven's Avatar
    Join Date
    Mar 2010
    Location
    Linz, Austria
    Posts
    29

    Default Problem reading values in XTemplate for a Combobox with an static Array as store)

    Hi

    So i tried and searched a lot, but i found no solution for my (maybe simple) problem.
    I've a quite simple combobox with an static array as store:

    PHP Code:
    new Ext.form.ComboBox({
                
    store: ["TEST","TEST2"],
                
    typeAheadtrue,
                
    forceSelectiontrue,
                
    tplloginComboTpl,
                
    triggerAction'all',
                
    value"TEST",
                
    selectOnFocus:true,
                
    anchor'90%'
            
    }) 
    As you see, and as i need cause i make an air application, i also define a tpl. This varible looks like:

    PHP Code:
    var loginComboTpl = new Ext.XTemplate(
            
    '<tpl for="."><div class="x-combo-list-item">{#} {.} {values}</div></tpl>'
    ); 
    So my problem is that i can't get the values from my static array. The index "{#}" is right, i got 2 entry's, but i don't get the values from my array.

    {.} = [object Object] ... but which one?
    {values} = nothing...


    so what does i have to use for that i get my values "TEST", "TEST2"?

    greetz
    Christopher

  2. #2
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,890

    Default

    You will still need to access field names of the fields in the Records of your Store.

    When a Store is auto-created from an Array like that it creates the field names "field1" (and if you used a 2d array, "field1" and "field2")

  3. #3
    Sencha User Zerogiven's Avatar
    Join Date
    Mar 2010
    Location
    Linz, Austria
    Posts
    29

    Default

    Quote Originally Posted by Animal View Post
    You will still need to access field names of the fields in the Records of your Store.

    When a Store is auto-created from an Array like that it creates the field names "field1" (and if you used a 2d array, "field1" and "field2")
    thx a lot! is there a notice in the docs somewhere? i searched so much for something like this. If there isn't it should be

    greetz

  4. #4
    Sencha User fay's Avatar
    Join Date
    Apr 2007
    Location
    Ireland
    Posts
    1,750

    Default

    is there a notice in the docs somewhere
    It's described in the descriptions of the ComboBox displayField and valueField config options.

  5. #5
    Sencha User Zerogiven's Avatar
    Join Date
    Mar 2010
    Location
    Linz, Austria
    Posts
    29

    Default

    Quote Originally Posted by fay View Post
    It's described in the descriptions of the ComboBox displayField and valueField config options.
    , so i read about 80% from the combobox doc... poor that my solution where in the last 20% , however, thanks!

    cheers

Posting Permissions

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