Hybrid View

  1. #1
    Sencha User
    Join Date
    Mar 2012
    Location
    Jakarta
    Posts
    30
    Vote Rating
    2
    arivwd is on a distinguished road

      0  

    Default How to find Combobox object within Store?

    How to find Combobox object within Store?


    Dear pros,

    I've created combobox with this :

    Code:
    {
        xtype:'combobox',
        id: 'comboMasterDepartemen',
        emptyText: 'No records',
        name: 'cmb1',
        allowBlank: true,
        fieldLabel: 'Parent Org. ',
        store: new Ext.data.Store({
            autoLoad: true,
            fields: ['id_departemen', 'nm_departemen'],
            proxy: {
                type: 'ajax',
                url : 'master_departemen/master_departemen/data/3',
                reader: {
                    type: 'json',
                    root : 'dataRecords'
                }
            },
            listeners: {
                load: function () {
                    var combo = Ext.getCmp('comboMasterDepartemen');
                     combo.clearValue();
                     combo.applyEmptyText();
                    if(this.getCount()>0) { combo.setValue(this.first().data.id_departemen); }
                }
            }
        }),
        editable: false,
        displayField: 'nm_departemen',
        valueField: 'id_departemen',
        labelAlign: 'right',
        anchor:'100%'
    }
    How do i get the combobox object within Store without defining " Ext.getCmp('comboMasterDepartemen'); " explicitly, so i dont have to define " id " prop in combobox.

    Thanx

  2. #2
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    9,154
    Vote Rating
    475
    scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future

      0  

    Default


    Have a look at itemId ..

    Code:
    itemId: 'comboMasterDepartemen'
    ..
    form.down('#comboMasterDepartemen');
    You can also look at
    Ext.ComponentQuery()
    component.query()

    Regards,
    Scott.

Thread Participants: 1