2011-11-16 3 views
2

내선 JS GridPanel 컬럼 폭을 확장하고,이 닮은 GridPanel 가지고I는 내선 JS 2.3.0을 사용

enter image description here

는 I 열의 폭을 확장하려는을 이러한 스크롤 바는 갔는지 패널의 가장 오른쪽에 배치하여 스크롤 막대의 오른쪽 빈 공간을 제거합니다.

관련 코드

는 다음과 같습니다 :

var colModel = new Ext.grid.ColumnModel([ 
     { 
      id: 'name', 
      header: locale['dialogSearch.column.name'], 
      sortable: true, 
      dataIndex: 'name' 
     } 
    ]); 

    var selModel = new Ext.grid.RowSelectionModel({singleSelect: false}); 

    this._searchResultsPanel = new Ext.grid.GridPanel({ 
     title: locale['dialogSearch.results.name'], 
     height: 400, 
     layout: 'fit', 
     stripeRows: true, 
     autoExpandColumn: 'name', 
     store: this._searchResultsStore, 
     view: new Ext.grid.GridView(), 
     colModel: colModel, 
     selModel: selModel, 
     hidden: true, 
     buttonAlign: 'center', 
     buttons: [ 
      { 
       text: locale["dialogSearch.button.add"], 
       width: 50, 
       handler: function() { 
       } 
      }, 
      { 
       text: locale["dialogSearch.button.cancel"], 
       width: 50, 
       handler: function() { 
        entitySearchWindow.close(); 
       } 
      } 
     ] 
    }); 

답변

0

문제는 열이 아니라 완전히 윈도우 몸을 채우기 위해 스트레칭하지 않는 그리드 자체.

layout: 'fit' 속성을 그리드 구성 (제거해야하는 위치) 대신 창 구성에 배치하십시오. 눈금 높이가 창 크기로 결정되므로 height 속성도 제거해야합니다.

+0

내 첫 번째 생각은 같았지 만 코드를 보면 , 그리드 실제로 버튼과 제목을 포함하므로 그리드는 실제로 정확한 크기입니다, 문제가되는 열입니다 – nscrob

+0

'layout'과'height' 속성을 제거하려 했습니까? –

+0

윈도우가 렌더 된 후 그리드를 추가합니까? 그렇다면, 컴포넌트를 추가 한 후'win.doLayout()'을 수행하십시오. –

2

당신은 그리드 뷰의 forceFit의 설정 사용해야합니다 :이 중복되지 않은 경우이 부분을 제거 할 수 있도록 view: new Ext.grid.GridView(),

+0

내 코드 –

+1

위의 그리드 구성에 'view : new Ext.grid.GridView()'가 없어도됩니다. 대신 위에 제시된 viewConfig를 넣을 수 있습니다. – nscrob

0

추가

this._searchResultsPanel = new Ext.grid.GridPanel({ 
     title: locale['dialogSearch.results.name'], 
     height: 400, 
     layout: 'fit', 
     viewConfig: { 
      forceFit: true 
     }, .... 

잘 모르겠어요를

flex: 1, 

이 열 중 하나에 설정 됨

관련 문제