1. #1
    Sencha User
    Join Date
    Mar 2009
    Posts
    43
    Vote Rating
    0
    yumusakg is on a distinguished road

      0  

    Default Unanswered: How can I display combobox text after form load?

    Unanswered: How can I display combobox text after form load?


    I can post the value of remote combobox with hiddenName. I couldn't accomplish showing the text of combobox after form load. This is a remote combo. So the store is not loaded after form load. So the combo only shows the value field...

    config for combobox
    Code:
    Ext.ns('portal', 'portal.common');
    
    portal.common.store_combo_company = new Ext.data.JsonStore({
        root: 'data',
        url: '../common/presentation/commondata.aspx',
        baseParams: {
            cmd: 'combo_company'
        },
        fields: [{
            name: 'ParamID',
            type: 'int'
        },
        {
            name: 'ParamDescription',
            type: 'string'
    }]
        });
    
        portal.common.ComboCompany = Ext.extend(Ext.form.ComboBox, {
            constructor: function(config) {
                config = Ext.apply({
                    store: portal.common.store_combo_company,
                    valueField: 'ParamID',
                    displayField: 'ParamDescription',
                    fieldLabel: 'Firma',
                    mode: 'remote',
                    typeAhead: false,
                    triggerAction: 'query',
                    minChars: 2
                }, config);
    
                portal.common.ComboCompany.superclass.constructor.call(this, config);
            }
        });
    
        Ext.reg('combocompany', portal.common.ComboCompany);
    apart from form's config
    Code:
    {
                id: 'form_contract',
                url: 'prcdata.aspx',
                xtype: 'form',
                baseCls: 'x-plain',
                labelWidth: 120,
                bodyStyle: 'padding:10px',
                defaults: { anchor: '100%', xtype: 'textfield' },
                items: [{
                    fieldLabel: 'contractId',
                    name: 'contractId',
                    xtype: 'hidden'
                }, {
                    id: 'prc_firma',
                    xtype: 'combocompany',
                    emptyText: 'Seçiniz',
                    hiddenName: 'Firma'
                }]
    }

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    St. Louis, MO
    Posts
    33,641
    Vote Rating
    434
    Answers
    3107
    mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of

      0  

    Default


    If the store hasn't finished loading when you set a value to the combo then you will need to reset the value once the store has finished loading.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    http://www.JSONPLint.com - Source to lint your JSONP!

    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    Mar 2009
    Posts
    43
    Vote Rating
    0
    yumusakg is on a distinguished road

      0  

    Default


    the combo retrieves 5000 rows. so i don't want to load these rows in form load... what i wanted to make is displaying combo value and text without loading combo store...

  4. #4
    Ext JS Premium Member
    Join Date
    Jan 2008
    Location
    Germany, Berlin
    Posts
    123
    Vote Rating
    7
    Answers
    18
    fschaeffer will become famous soon enough

      0  

    Default


    You could use setRawValue to simply display the value you want.

    I usally use a combination of setValue & setRawValue. So the combobox IS aware of the to-be-used-value and correctly transmits the value but without loading the store...

    HTH
    Florian

  5. #5
    Sencha User
    Join Date
    Mar 2009
    Posts
    43
    Vote Rating
    0
    yumusakg is on a distinguished road

      0  

    Default


    thank you @fschaeffer,

    setRawValue worked very well.

    But it is extra code to implement this common requirement.. I think this must be functionality of combo component. An additional config item like loadValue which will bind the action.result.data.<data_item> to combobox RawValue could be easily implemented.. so we didn't have to write extra code..