Results 1 to 9 of 9

Thread: ComboBox with remote JsonStore not showing displayValue

  1. #1

    Default ComboBox with remote JsonStore not showing displayValue

    I have a ComboBox with a remote JsonStore (autoload: true).
    When i give the ComboBox a value it just shows the value and not the displayValue.
    I also noted that the store fetches it's data twice.
    Once when i open the form, a second time when i open the ComboBox

    new Ext.form.ComboBox({
        id: 'ExtId141',
        fieldLabel: 'Bedrijf',
        name: 'company_id',
        margins: '5 5 5 5',
        allowBlank: false,
        msgTarget: 'qtip',
        anchor: '-4',
        value: '4',
        editable: false,
        forceSelection: true,
        minChars: 0,
        queryParam: '-1',
        valueField: 'id',
        displayField: 'company',
        hiddenName: 'company_id',
        mode: 'remote',
        store: new{
            storeId: 'ExtId142',
            root: 'items',
            totalProperty: 'totalCount',
            idProperty: 'id',
            remoteSort: true,
            fields: [{
                name: 'id'
                name: 'company'
            proxy: new{
                url: '/dataManager/list/company'
            listeners: {
                loadexception: function (a, request, response, error) {
                    if (Ext.decode(response.responseText).msg) {
                        errorMessage = Ext.decode(response.responseText).msg;
                    } else {
                        errorMessage = error.message;
                    Ext.MessageBox.alert('Error', errorMessage);
            sortInfo: {
                field: 'company',
                direction: 'ASC'
            autoLoad: true,
    I found this thread which does offer a solution, however now the data gets fetched 3 times.
    2 times on form load, 1 when you open up the ComboBox.

    Does anybody have a solution that doesn't involve loading in the SAME data multiple times?

    Thanks in advance!

  2. #2
    Ext JS Premium Member prophet's Avatar
    Join Date
    Mar 2007
    Greenwich, CT


    I think you should remove the autoLoad: true... unless it's used somehow (you also have an extra comma after that which would be invalid)

    The data will be loaded on the trigger event.

    Also, why are you using a proxy for the JsonStore? I'd just include the url config option in the JsonStore itself.

    Perhaps add a triggerAction: 'all' too, to the ComboBox.

  3. #3


    Right, so i turned autoLoad off and added triggerAction: 'all' to the ComboBox.
    This did cut back the amount of data requests to one, however it didn't load the data when i show the form.
    I need to manually open the ComboBox before it fetches it data.
    And obviously without the data it can't show a proper displayValue.

    Regarding the proxy, good question.
    Must have picked that up somewhere and never bothered to look into it.
    It's now setting the url directly, thanks for the tip.

  4. #4
    Sencha User aw1zard2's Avatar
    Join Date
    Sep 2009
    Dallas, Texas


    Try lazyInit: false
    It defaults to true.

  5. #5


    Same result as before, store doesn't get loaded until i open it manually.

  6. #6
    Sencha User aw1zard2's Avatar
    Join Date
    Sep 2009
    Dallas, Texas


    You try lazyInit with autoLoad: true?

  7. #7


    That does load the store data on form load, but still doesn't set the proper displayValue

  8. #8
    Sencha User aw1zard2's Avatar
    Join Date
    Sep 2009
    Dallas, Texas


    Have you tried setting the value after the store is loaded on the first time?

  9. #9


    I'll have a go at that, thanks so far.
    In the mean time, if anyone has any suggestion keep 'm coming, all advice / help is welcome.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts