1. #1
    Ext User
    Join Date
    Sep 2007
    Posts
    43
    Vote Rating
    0
    bowa is on a distinguished road

      0  

    Default Combobox with default value

    Combobox with default value


    I am adding a combobox to a fieldset

    Code:
    			items :[{
    				xtype: 'combo',
    				fieldLabel: 'Address',
    				hiddenName: 'shipment-' + number + '-addr',
    			    store: addrStore,
    			    tpl: resultTpl,
    			    triggerAction: 'all',
    			    displayField:'friendly',
    			    valueField:'id',
    			    value: addressId,
    			    emptyText:'Select an address...',
    			    selectOnFocus:true,
    			}
    it get the adresses from a store that gets its data using a DWRProxy, it uses XTemplate to display a nice list of the adresses and when i post the form, the 'id' of the address gets posted. All that is working as intended.

    The problem i have is when i want to set the value, (the address has been chosen before), i know the 'id' and its stored in variable 'addressId', so i thought i could use

    Code:
    value: addressId,
    but that sets the numerical id to the displayField instead of the 'friendly' value from the corresponding record. (but these records are not loaded yet, the store gets filled when you hit the trigger ...)

    what is the best solution for this ?

  2. #2
    Sencha User catacaustic's Avatar
    Join Date
    Jul 2007
    Location
    "A Land Down Under"
    Posts
    618
    Vote Rating
    1
    catacaustic is on a distinguished road

      0  

    Default


    The best solution that I can think of for this would be to not set the value before the store is loaded as you are trying to do there. As you've found, that doesn't work if the records aren't loaded yet.

    I'd set up a listener for the 'load' event of the store that check what the current selection is (that should be 'addressId' in your case) and sets that whenever the store is loaded. That way you can still get the value in there and you aren't left with this strange number that no one will recognise in there beforehand.
    'Once again, fortune vomits on my eiderdown'
    - Edmund Blackadder

Thread Participants: 1

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar