[英]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在那里。 我会像这样设置初始值:
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.