extjssencha-architect

ComboBox dropdown width in a grid, widen when selection itme in list? ExtJS 7.X


Im using a combobox in a grid with Extjs 7.6. The dropdown list doesnt expand therefore the single items in the list are displayed in multiple rows. Is there a way to change the dropdown list to a fixed or dynamic width WITHOUT changing the dropdown itself?

Im using Sencha Architect, so i searched in configs for a solution. But i could not find anything besides:

My gridcolumn code:

xtype: 'gridcolumn',
flex: 1.75,
width: 200,
sortable: true,
dataIndex: 'status',
menuDisabled: true,
bind: {
    text: '{status}'
},
editor: {
    xtype: 'combobox',
    itemId: 'mycombobox2',
    editable: false,
    displayField: 'title',
    queryMode: 'local',
    store: 'StatiOfOrdersStore',
    valueField: 'id'
}

The only answer i found so far ist this comment on an very old question: https://stackoverflow.com/a/72280729/21182733 But when i add an BasicEvent in Sencha Architect, there is no beforepickercreate event.

As you can tell, im fairly new to extjs/js.


Solution

  • Found an answer, i added this code in an beforeshow event to mycombobox:

    listConfig: {
         listeners: {
             beforeshow: function(picker) {
                 picker.minWidth = picker.up('combobox').inputEl.getSize().width;
             }
          }
    

    For this to work you need to set matchFieldWidth to false.