combo beforeQuery

by Johan Vandeplas

HTML

<script src="http://cdn.sencha.com/ext/gpl/4.2.1/ext-all-dev.js"></script>
<link rel="stylesheet" href="http://cdn.sencha.com/ext/gpl/4.2.1/resources/css/ext-all.css">

JavaScript

// The data store containing the list of states
var states = Ext.create('Ext.data.Store', {
    fields: ['abbr', 'name'],
    data : [
        {"abbr":"AL", "name":"Alabama"},
        {"abbr":"AK", "name":"Alaska"},
        {"abbr":"AZ", "name":"Arizona"}
        //...
    ]
});

// Create the combo box, attached to the states data store
Ext.create('Ext.form.ComboBox', {
    flex: 2,
    fieldLabel: 'other',
    displayField: 'name',
    name: 'city_name',
    itemId:'city_name',
    emptyText: 'plaats',
    
    store: states,
    valueField: 'abbr',
    renderTo: Ext.getBody(),
    beforeQuery: function( queryEvent, eOpts ){
        console.log(queryEvent, 'bam');
        return true;
    }
});