Extjs4 itemId, cómo recuperar un editor de columnas de cuadro combinado

I am trying to convert some ExtJS 3.3 to 4.0. In ExtJS 3.x I could create a combobox with a unique component Id, that I could use later with Ext.getCmp(Id), to get that combo editor, so that I could add filters, or play with the combo box itself.

Now if I specify an Id, the grid does not render the combo box correct in the grid, they say I have to use itemId instead, then actually it works, I mean combo renders correctly on the grid, But then I have no way of using that itemId to get the combobox itself.

I tried grid.getComponent(itemId), grid.headerCt.getComponent(), I have to say what the heck is this itemId good for, how on earth am I supposed to get this editor.

grid.columns collection has editor for simple fields (like text, number), for combobox it has getEditor which asks for a data record as a param.

I have to say again wtf, was so wrong with ExtJS 3.x that they felt like fixing and f.... it up.

Really, this upgrade made me go wtf so many times.... maybe its my fault, but wtf... anyways.

{
    header: 'Ürün/Hizmet',
    width: 90,
    dataIndex: 'AlinanHizmetId',
    editor: {
        itemId: 'AlinanHizmetId',
        xtype: 'combobox',
        allowBlank: false,
        selectOnFocus: true,
        valueField: 'Id',
        displayField: 'HizmetAd',
        triggerAction: 'all',
        typeAhead: false,
        forceSelection: true,
        lazyRender: true,
        minChars: '2',
        listWidth: 300,
        store: Ext.create('Ext.data.Store', {
            storeId: '',
            fields: [{
                name: 'HizmetTipAd',
                caption: 'Hizmet Tip Adı',
                type: Ext.data.Types.STRING,
                clrType: 'String'
            }, {
                name: 'Id',
                caption: 'Id',
                type: Ext.data.Types.STRING,
                clrType: 'Guid'
            }, {
                name: 'HizmetTip',
                caption: 'HizmetTip',
                type: Ext.data.Types.STRING,
                clrType: 'String'
            }, {
                name: 'HizmetKod',
                caption: 'Hizmet Kodu',
                type: Ext.data.Types.STRING,
                clrType: 'String'
            }, {
                name: 'HizmetAd',
                caption: 'Hizmet Adı',
                type: Ext.data.Types.STRING,
                clrType: 'String'
            }, {
                name: 'Aciklama',
                caption: 'Açıklama',
                type: Ext.data.Types.STRING,
                clrType: 'String'
            }],
            autoDestroy: false,
            autoLoad: true,
            autoSave: false,
            sortInfo: {
                field: 'HizmetAd',
                direction: 'ASC'
            },
            restful: false,
            proxy: {
                type: 'ajax',
                actionMethods: {
                    read: 'POST'
                },
                url: '/Yol/Combo/AlinanHizmet',
                reader: {
                    type: 'json',
                    root: 'data',
                    idProperty: 'Id',
                    totalProperty: 'rowCount',
                    successProperty: 'success',
                    messageProperty: 'message'
                }
            },
            data: []
        })
    },
    filter: {
        xtype: 'textfield'
    },
    renderer: function (value, metaData, record, rowIndex, colIndex, store) {
        return record.get('HizmetAd');
    }
}

preguntado el 31 de enero de 12 a las 08:01

¿Has probado Ext.ComponentQuery? Tratar grid.query('#item_id'). -

yes, it returns empty array. "[]" -

there it is, just the column config. There is more to it, I had to delete some parts of it. -

2 Respuestas

This is old - but have you tried grid.down('#item_id')?

respondido 23 mar '12, 21:03

mygrid.on('beforeedit', function(e){
    if(e.field == 'ProductId') {
      var gridCols = Ext.getCmp('my_grid').columns;
      for(i = 0; i < gridCols.length; i++)
          if (gridCols[i].dataIndex == 'ProductId') break;
      var combo = gridCols[i].getEditor(e.record);
    ...

so actually column.getEditor(null) does the trick.

respondido 26 mar '12, 16:03

I dont know if columns is a mixedcollection or array or something else, that is why I have the for loop there. - hazimdikenli

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.