簡體   English   中英

選擇gwt celltable行

[英]make the gwt celltable row selected

我在GWT中有一個帶有列的單元格表,每列有3行,我希望在應用程序啟動時默認選擇第一行

這樣的事情

                 mycelltable.setselectedrow(index);

可能嗎 ?

謝謝

她是代碼

                      display.getShortListedCVsBasedOnJob().getResumeDescriptionColumn().setFieldUpdater(

            new FieldUpdater<CandidateSummary, String>() {
                public void update(int index, CandidateSummary object,
                        String value) {

                    fetchResume(cvSelected, shortListedFlag);
                }
            });

這個fetchResume()方法調用但是只有當我選擇了這個列的單元格時,我想在我的應用程序啟動時調用這個fetchResume()方法,即我想通過默認選擇列的第一個單元格。

選擇是由一個處理SelectionModel基於對象(未索引); 所以你必須從CellTable使用的SelectionModel你的數據中的第一個對象(看看使用一個鍵提供程序來跟蹤對象,因為他們Celltable javadoc中 更改了示例代碼的例子( 嵌套類摘要之前的最后一個樣本) )。

這可行嗎?

setSelected(Element elem, boolean selected) 

請參閱GWT文檔

CellTable Google Web Toolkit

嗯,我沒看到Celltable在那里。 我會像這樣設置初始值:

int INITAL_SET_ROW = 0;
TableRowElement initalSetElement = yourCellTable.getRowElement(INITAL_SET_ROW);
yourCellTable.setSelected(initialSetElement, true);

您可以嘗試在主要方法中實現它。 沒有測試它,希望它有所幫助。

只是;

List<RowType> source = new LinkedList<RowType>(); 
//put some data to this list
//populate the table
table.setRowCount(source.size(), true);
table.setRowData(0, source);
//for example, you can select the first row
RowType firstRow = source.get(0);
selectionModel.setSelected(firstRow, true);

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM