Results 1 to 2 of 2

Thread: How to find Combobox object within Store?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Sencha User
    Join Date
    Mar 2012
    Location
    Jakarta
    Posts
    33
    Vote Rating
    2
      0  

    Default 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,390
    Vote Rating
    498
      0  

    Default

    Have a look at itemId ..

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

    Regards,
    Scott.

Posting Permissions

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