Results 1 to 4 of 4

Thread: Default value in multi select combobox duplicating value

  1. #1
    Sencha User
    Join Date
    Mar 2017
    Posts
    3

    Default Default value in multi select combobox duplicating value

    I am defining a default value in multi select combobox. The default value is displayed correctly in the combo but when I open the drop down and choose the same value instead of erasing it from the box it doubles it.
    For example: The default value is Open. When the combo is loaded the chosen value is Open, however when I click the arrow to show all the combo options and click Open the selected value now shows:'Open,Open'
    (as opposed to removing the first Open and showing empty.).
    Here is my definition:
    Ext.define('ExtDoc.views.extfields.ExtDocConditionalFilterComboField', {
    extend: 'Ext.form.ComboBox',
    updateAfterRender: function(){

    var value;
    if( this.fieldProperties.get("defaultValue"))
    {
    value=this.fieldProperties.get("defaultValue")
    var valueRec = this.findRecordByValue (value);
    this.setValue(valueRec?valueRec.get('code'):'');
    this.orgValue = this.getValue();

    }
    }

  2. #2
    Sencha Premium User
    Join Date
    May 2016
    Posts
    20

    Default

    Did you declare the valueField config in your combobox? It seems that your first 'Open' and second 'Open' have different ID that's why it's being considered as 2 different items.

    See the fiddle

    https://fiddle.sencha.com/#view/editor&fiddle/22o8

  3. #3
    Sencha User
    Join Date
    Mar 2017
    Posts
    3

    Default

    I have declared the valueField in the father class that i didnt include here.
    Also when debugging I can see that both 'OPEN's have the same code-4.
    Your fiddle is not a relevant example because the combo is not multi select. When I change my combo to be single select the combo works correctly. it is the multi select that is causing the problem.

    Quote Originally Posted by ma.l View Post
    Did you declare the valueField config in your combobox? It seems that your first 'Open' and second 'Open' have different ID that's why it's being considered as 2 different items.

    See the fiddle

    https://fiddle.sencha.com/#view/editor&fiddle/22o8

  4. #4
    Sencha Premium User
    Join Date
    May 2016
    Posts
    20

    Default

    I couldn't include multiSelect in the fiddle because it kept giving me errors saying multiSelect is not yet supported. I can't see your combobox config to really see what's different from my working one. But here is mine if it helps. My default value is set through binding. When I select on the default value in the drop-down, the default gets deselected and the combobox empties.


    I also tried to replicate your code in my combobox by setting the default value through the console with

    vendorNameComboBox.setValue('Ameri Gas');

    The vendor was selected and displayed in the field. And I can see it highlighted in the drop-down. Clicking on it deselected it and cleared the display field.

    Code:
    {
        xtype: 'combobox',
        columnWidth: 0.6,
        reference: 'vendorName',
        margin: '10 20 0 0',
        afterLabelTextTpl: [
            '<span style="color:red;font-weight:bold" data-qtip="Required"> *</span>'
        ],
        fieldLabel: 'Vendor',
        name: 'vendor_name',
        allowBlank: false,
        displayField: 'name',
        queryMode: 'local',
        store: 'Enrollments.Vendors',
        valueField: 'name',
        multiSelect: true,
        bind: {
            value: '{theAccount.vendor_name}'
        }
    }

Similar Threads

  1. Multi-select in combobox with ASP.NET WEB API
    By BastianKrones in forum Ext: Q&A
    Replies: 2
    Last Post: 29 Apr 2013, 10:48 PM
  2. Replies: 0
    Last Post: 9 Jun 2011, 7:28 AM
  3. Multi-select ComboBox
    By markalroberts in forum Sencha Ext JS Q&A
    Replies: 4
    Last Post: 30 Sep 2009, 2:26 AM
  4. Ext1.1 Multi-Select Combobox
    By rrschwartz in forum Sencha Ext JS Q&A
    Replies: 5
    Last Post: 19 Mar 2009, 1:11 PM
  5. multi-select combobox?
    By daemach in forum Sencha Ext JS Q&A
    Replies: 1
    Last Post: 8 Jan 2008, 1:37 PM

Tags for this Thread

Posting Permissions

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