2014-07-23 3 views
1

아래 코드는 2 개의 탭을 만듭니다. 각 탭에는 1 개의 열이있는 눈금이 있습니다. 첫 번째 탭에서 표 머리글은 열 숨기기/표시 및 정렬과 함께 드롭 다운을 표시합니다. 두 번째 탭의 드롭 다운이 테이블 머리글에서 누락되었습니다.GXT 3.1.0 - 그리드 머리글에서 누락 된 드롭 다운 정렬

내가 뭘 잘못하고 있니? 드롭 다운에 작은 버튼이 0 높이를 가지고 같은 감사

public void onModuleLoad() 
{ 
    Grid table1 = createTable(); 
    Grid table2 = createTable(); 

    TabPanel tabPanel = new TabPanel(); 
    tabPanel.add(table1, "Grid 1"); 
    tabPanel.add(table2, "Grid 2"); 

    RootLayoutPanel.get().add(tabPanel); 
} 

Grid createTable() 
{ 
    ColumnConfig<HashMap, String> nameCol = new ColumnConfig<HashMap, String>(

    new ValueProvider<HashMap, String>() 
    { 
     @Override 
     public String getValue(HashMap object) 
     { 
      return (String) object.get("COL1"); 
     } 

     @Override 
     public void setValue(HashMap object, String value) 
     { 
      object.put("COL1", value); 
     } 

     @Override 
     public String getPath() 
     { 
      // TODO Auto-generated method stub 
      return "1"; 
     } 

    }, 200, SafeHtmlUtils.fromTrustedString("<b>Column 1</b>")); 

    List<ColumnConfig<HashMap, ?>> l = new ArrayList<ColumnConfig<HashMap, ?>>(); 
    l.add(nameCol); 
    ColumnModel<HashMap> cm = new ColumnModel<HashMap>(l); 

    ModelKeyProvider<HashMap> modelKeyProvider = new ModelKeyProvider<HashMap>() 
    { 
     @Override 
     public String getKey(HashMap item) 
     { 
      return (String) item.get("COL1"); 
     } 
    }; 

    ListStore<HashMap> store = new ListStore<HashMap>(modelKeyProvider); 
    store.addAll(getStocks()); 

    Grid table = new Grid(store, cm); 

    return table; 
} 

public static List<HashMap> getStocks() 
{ 
    List<HashMap> stocks = new ArrayList<HashMap>(); 

    for (int i = 0; i < 1000; i++) 
    { 
     HashMap hashMap = new HashMap(); 
     hashMap.put("COL1", "Line: " + i); 

     stocks.add(hashMap); 
    } 
    return stocks; 
} 

답변

1

보인다. 그것은 보이지 않는 탭 안에 있기 때문입니다.

헤더를 새로 고치면 해결됩니다.

TabPanel tabPanel = new TabPanel(); 
tabPanel.addSelectionHandler(new SelectionHandler<Widget>() 
{ 
    @Override 
    public void onSelection(SelectionEvent<Widget> event) 
    { 
     if(table1.getView() != null && table1.getView().getHeader() != null) 
      table1.getView().getHeader().refresh(); 
    } 
});