Results 1 to 5 of 5

Thread: setValue in combobox strange result

  1. #1
    Ext User
    Join Date
    Feb 2008
    Posts
    146

    Default setValue in combobox strange result

    this is my combobox code:

    var notaSelectEdit = new Ext.form.ComboBox({
    fieldLabel: 'N° nota AIFA',
    id: 'editaifa',
    xtype: 'combo',
    hiddenId: 'idnew',
    hiddenName: 'idnota',
    displayField: 'n_nota',
    valueField: 'id',
    loadingText: 'Ricerca...',
    pageSize: 40,
    minChars: 0,
    queryDelay: 500,
    width: 530,
    labelWidth: 530,
    triggerAction: 'all',
    forceSelection: true,
    name: 'editaifa',
    store: nota,
    typeAhead: false,
    emptyText: 'Seleziona la nota...',
    allowBlank: false,
    tpl: notaTpl,
    itemSelector: 'div.search-item'
    });

    and i try to set the value with this command:

    notaSelectEdit.setValue(idofthevaluedisplay);

    i this way i see the ID in the combobox and not the related value.

    if i try with this command:

    notaSelectEdit.setValue(valuedisplay);

    in this way i see the correct Value in the combobox but when i submit the form don't submit the ID of the value displayed...

    if i select the value from the list manually all work perfect and the submit sent the ID of the value displayed..

    can you help? what's wrong??

    thank you

  2. #2
    Sencha User jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    DC Area =)
    Posts
    16,364

    Default

    If the store is not loaded, then it cannot set the "display" value

  3. #3
    Sencha User
    Join Date
    Sep 2008
    Location
    vietnam
    Posts
    14

    Default

    you can add listeners to store nota
    Code:
    nota.on("load", function(store){
    notaSelectEdit.setValue(idofthevaluedisplay);
    });

  4. #4
    Sencha User Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,245

    Default

    Or use the override from this feature request.

  5. #5

    Default

    notaSelectEdit.setValue(idofthevaluedisplay);
    notaSelectEdit.lastSelectionText = valuedisplay;

    But you need to make sure that the combo is loaded with options already

Posting Permissions

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