ExtJS 5.1.0 - Dynamic Combobox

ExtJS 5.1.0 - Dynamic Combobox Creation and Destruction Test

by Alexander Tymchuk

HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/extjs/6.0.1/ext-all.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/extjs/6.0.1/classic/theme-triton/resources/theme-triton-all.css">
<div id="output">
</div>
<div id="command">
</div>

JavaScript

var store = Ext.create('Ext.data.ArrayStore', {
    fields: [
      {name: 'id'},
      {name: 'company'}
    ],
    data  : [
      [1,'Ali Baba'],
      [2,'Alcoa Inc'],
      [3,'Altria Group Inc'],
      [4,'American Express Company'],
      [5,'American International Group, Inc.'],
      [6, 'AT&T Inc.'],
      [7, 'Boeing Co.'],
      [8, 'Caterpillar Inc.'],
      [9, 'Citigroup, Inc.'],
      [10, 'E.I. du Pont de Nemours and Company'],
      [11, 'Exxon Mobil Corp'],
      [12, 'General Electric Company'],
      [13, 'General Motors Corporation'],
      [14, 'Hewlett-Packard Co.'],
      [15, 'Honeywell Intl Inc'],
      [16, 'Intel Corporation'],
      [17, 'International Business Machines'],
      [18, 'Johnson & Johnson'],
      [19, 'JP Morgan & Chase & Co'],
      [20, 'McDonald\'s Corporation'],
      [21, 'Merck & Co., Inc.'],
      [22, 'Microsoft Corporation'],
      [23, 'Pfizer Inc'],
      [24, 'The Coca-Cola Company'],
      [25, 'The Home Depot, Inc.'],
      [26, 'The Procter & Gamble Company'],
      [27, 'United Technologies Corporation'],
      [28, 'Verizon Communications'],
      [29, 'Wal-Mart Stores, Inc.'],
      [30, 'Walt Disney Company (The) (Holding Company)']
    ]
});
function renderPanel() {
  return Ext.create('Ext.form.Panel', {
  	id: 'Auto-Form',
    width: 400,
    frame: true,
    title: 'ExtJS Autocomplete ComboBox',
    padding: 0,
    fieldDefaults: {
      msgTarget : 'side',
      labelWidth: 100
    },
    defaultType: 'textfield',
    defaults: {
      anchor: '100%'
    },
    items: [{
      xtype : 'displayfield',
      value : 'Type first two characters of your company to select it.'
    },{
      fieldLabel: 'Company',
      xtype     : 'combobox',
      emptyText : 'Company name',
      typeAhead : true,
      minChars  : 2,
      store     : store,
      valueField    : 'id',
      triggerAction : 'query',
      hideTrigger   : true,
      displayField  : 'company'
    }],
    dockedItems: [{
      xtype:...