2012-01-31 2 views
0

일부 ExtJS 3.3을 4.0으로 변환하려고합니다. ExtJS 3.x에서는 Ext.getCmp (Id)와 함께 나중에 사용할 수있는 고유 한 구성 요소 ID를 사용하여 콤보 상자를 만들 수 있습니다.이 콤보 편집기를 사용하여 필터를 추가하거나 콤보 상자 자체에서 재생할 수 있습니다 .Extjs4 itemId, 콤보 상자 열 편집기를 다시 얻는 방법

이제 ID를 지정하면 그리드가 실제로 그리드에서 콤보 상자를 렌더링하지 않습니다. 대신 itemId를 사용해야한다고 말하면 실제로 작동하지만 콤보가 그리드에서 올바르게 렌더링된다는 것을 의미합니다. 그렇다면 그 itemId를 사용하여 콤보 박스 자체를 얻을 방법이 없습니다.

grid.getComponent (itemId), grid.headerCt.getComponent()를 사용해 보았는데,이 항목이 얼마나 좋은지 말할 필요가 있습니다.이 편집기를 사용하려면 어떻게해야할까요?

grid.columns 컬렉션에는 텍스트, 숫자와 같은 간단한 필드에 대한 편집기가 있으며 combobox에는 데이터 레코드를 param으로 요청하는 getEditor가 있습니다.

나는 다시 말해야 만한다. ExtJS 3.x에서 잘못 고쳐서 f ....라고 느꼈다.

정말로,이 업그레이드로 인해 나는 여러 번 무거운 짐을지었습니다 .... 어쩌면 그게 내 잘못이라고해도 ....

{ 
    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'); 
    } 
} 
+0

'Ext.ComponentQuery'을 사용해 보셨나요? 'grid.query ('# item_id')'를 시도하십시오. – Krzysztof

+0

예, 빈 배열을 반환합니다. "[]" – hazimdikenli

+0

소스 코드를 게시 할 수 있습니까? – Krzysztof

답변

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); 
    ... 

그래서 실제로 column.getEditor (null)이 트릭을 수행합니다.

+0

열이 mixedcollection 또는 배열 또는 뭔가 다른, 그 이유는 거기에 루프가 있는지 알 수 없습니다. – hazimdikenli

0

이 오래 -하지만 당신은 grid.down('#item_id')를 시도?