0

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');
    }
}
3
  • Have you tried Ext.ComponentQuery? Try grid.query('#item_id').
    – Krzysztof
    Jan 31, 2012 at 9:21
  • yes, it returns empty array. "[]" Jan 31, 2012 at 9:29
  • there it is, just the column config. There is more to it, I had to delete some parts of it. Jan 31, 2012 at 11:17

2 Answers 2

0

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

0
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.

1
  • I dont know if columns is a mixedcollection or array or something else, that is why I have the for loop there. Mar 26, 2012 at 12:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.