Search code examples
extjscomboboxextjs4multi-select

How do i make my reporting manager field a multiselect or superboxselect?


This is something that I found in the tutorials

items: [{
    anchor: '100%',
    xtype: 'multiselect',
    msgTarget: 'side',
    fieldLabel: 'Multiselect',
    name: 'multiselect',
    id: 'multiselect-field',
    allowBlank: false,
    store: {
        fields: ['number', 'numberName'],
        proxy: {
            type: 'ajax',
            url: 'Numbers',
            reader: 'array'
        },
        autoLoad: true
    },
    valueField: 'number',
    displayField: 'numberName',
    value: ['3', '4', '6'],
    ddReorder: true
}];

But when I tried it in my code error occurred. Is there something else that needs to be done additional to just changing xtype from combo to multiselect to make it a mutiselect?

{
    xtype: 'combo',
    fieldLabel: 'Reporting Manager',
    labelWidth: '130px',
    store: 'LeaveRequest',

    displayField: 'reportingmanager',
    afterLabelTextTpl: required,
    name: 'reportingmanager',
    allowBlank: false,
    //dockedItems: 'multiselect-field',
    afterLabelTextTp1: required
}

Solution

  • Multiselect is an user extended class, If you look at the begining of the code in the tutorials the ux files are included.

    Ext.Loader.setPath('Ext.ux', '../ux');
    Ext.require([
        'Ext.form.Panel',
        'Ext.ux.form.MultiSelect',
        'Ext.ux.form.ItemSelector'
    ]);
    

    You need to include those files in order for the multiselect to work

    <script type="text/javascript" src="extjs/examples/ux/form/MultiSelect.js"></script>
    <script type="text/javascript" src="extjs/examples/ux/form/ItemSelector.js"></script>
    

    Check in your firebug/developer tools if this files are loaded , and then you can use xtype multiselect;