[英]make the gwt celltable row selected
I have a cell Table in GWT with columns , there are 3 rows in each column, I want the first row to get selected by default when the application starts 我在GWT中有一个带有列的单元格表,每列有3行,我希望在应用程序启动时默认选择第一行
some thing like this 这样的事情
mycelltable.setselectedrow(index);
is it possible ? 可能吗 ?
Thanks 谢谢
her is the code 她是代码
display.getShortListedCVsBasedOnJob().getResumeDescriptionColumn().setFieldUpdater(
new FieldUpdater<CandidateSummary, String>() {
public void update(int index, CandidateSummary object,
String value) {
fetchResume(cvSelected, shortListedFlag);
}
});
This fetchResume() method calls but only when i select cell of this column , I want to call this fetchResume() method as my application starts, ie i want to make the 1st cell of the column to be selected byDefault. 这个fetchResume()方法调用但是只有当我选择了这个列的单元格时,我想在我的应用程序启动时调用这个fetchResume()方法,即我想通过默认选择列的第一个单元格。
Selection is handled by a SelectionModel
, based on objects (not indices); 选择是由一个处理SelectionModel
基于对象(未索引); so you have to select the first object from your data in the SelectionModel
used by the CellTable
(have a look at the Using a key provider to track objects as they change sample code in the Celltable
javadoc for an example (last sample before nested classes summary ). 所以你必须从CellTable
使用的SelectionModel
你的数据中的第一个对象(看看使用一个键提供程序来跟踪对象,因为他们在Celltable
javadoc中 更改了示例代码的例子( 嵌套类摘要之前的最后一个样本) )。
This could work? 这可行吗?
setSelected(Element elem, boolean selected)
see GWT Documentation 请参阅GWT文档
CellTable Google Web Toolkit CellTable Google Web Toolkit
Hmm I dont see what´s the Celltable is there. 嗯,我没看到Celltable在那里。 I would set the initial Value like this: 我会像这样设置初始值:
int INITAL_SET_ROW = 0;
TableRowElement initalSetElement = yourCellTable.getRowElement(INITAL_SET_ROW);
yourCellTable.setSelected(initialSetElement, true);
You can try to implement it in you´re main Method. 您可以尝试在主要方法中实现它。 Haven´t tested it tho, hope it helps. 没有测试它,希望它有所帮助。
Simply; 只是;
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.