2015-03-25 69 views
0

我有一個FlexTable,其中包含一個包含DataGrid的ScrollPane。 ScrollPane設置爲100%寬度,450px高度。 DataGrid設置爲200%寬度和450px高度。DataGrid垂直滾動條僅當DataGrid滾動到最右邊時纔可見

水平滾動條允許我按預期水平滾動表格。但是,如果我一直滾動到右側,則可以讓我滾動瀏覽不同行的垂直滾動條可見。有沒有辦法改變這種行爲,以便垂直滾動條總是在右側可見,例如在C#的DataGrid中?

我正在查看DataGrid的API並沒有看到任何有用的東西。我總是將ShowScrolLBars設置爲true。

回答

0

我的問題是我不應該把一個DataGrid放在一個ScrollPane裏面,因爲GWT的DataGrid內置了滾動功能。爲了獲得所需的滾動行爲,我設置了數據網格的大小,然後設置了表的大小這比整個數據網格小部件大)。

// full width, 55% height 
    int dataGridPixelHeight = (int) (Window.getClientHeight() * 0.55);  
    m_resultsDataGrid.setSize("100%", dataGridPixelHeight + "px"); 

    // sets the actual inner grid to be wide, allowing horizontal scroll 
    m_resultsDataGrid.setTableWidth(200, Unit.PCT);