javascriptcssextjssassextjs7

ExtJS - Combobox Multiselect padding


I am using the Modern Toolkit of ExtJS 7.3.1, and I have found a strange behaviour in the Combobox styles when the multiSelect option is set to true. I have created a simple ExtJS application with two comboboxes. The only difference between them, is that one has the multiSelect option set to true, and the other one have it set to false. I include the code for this simple application below.

    Ext.application({
    name: 'Fiddle',

    launch: function () {
        Ext.create('Ext.form.Panel', {
            fullscreen: true,
            items: [{
                xtype: 'fieldset',
                items: [{
                    xtype: 'combobox',
                    label: 'State',
                    id: 'firstLabel',
                    name: 'stateMulti',
                    multiSelect: true,
                    displayField: 'name',
                    valueField: 'abbr',
                    store: [
                        { abbr: 'AL', name: 'Alabama' },
                        { abbr: 'AK', name: 'Alaska' },
                        { abbr: 'AZ', name: 'Arizona' }
                    ]
                },
                 {
                    xtype: 'combobox',
                    label: 'State',
                    id: 'secondLabel',
                    name: 'stateSingle',
                    multiSelect: false,
                    displayField: 'name',
                    valueField: 'abbr',
                    store: [
                        { abbr: 'AL', name: 'Alabama' },
                        { abbr: 'AK', name: 'Alaska' },
                        { abbr: 'AZ', name: 'Arizona' }
                    ]
                }]
            }]
        });
    }
   });

After running this application, I see that there is a small padding in the label when the multiSelect option is set to true, as it can be seen in the picture below. Is there any way to override this behaviour? I feel it has something to do with the style of the Modern Toolkit for multiselection comboboxes, but I am not sure. Any help will be appreciated.

Comboboxes


Solution

  • Add for modern - material to your CSS

    .x-selectfield .x-chipview .x-chipview-body-el {
        padding: 0;
    }
    

    The difference is, that ExtJS adds a chipview, to allow multiselected items to be added in line.

    Sidenote

    For the multiselect I would strongly recommend to go for ExtJS 7.5, because the duplicate error for the first item is fixed there.