Fab*_* B. 1 gwt google-app-engine cell objectify
我目前正在使用Gwt CellTable,通过RPC调用绑定到我的GAE/Objectify后端.
现在好了!:-)
然后我想对列进行排序,所以我看了http://code.google.com/intl/it-IT/webtoolkit/doc/latest/DevGuideUiCellTable.html#columnSorting
Async Remote排序部分很好地展示了如何排序到我的AsyncDataProvider但是...如何检索用户想要排序的列的名称?
它显示了这段代码: ColumnSortList sortList = table.getColumnSortList();
但是如何从中获取String名称呢?我只想知道"姓氏"或"soldDate",列所绑定的字段的名称!然后我将它传递给我的rpc服务,并使用它来排序数据服务器端query(...).order(<field_name>)
我错过了什么吗?
UPD:这里有趣的东西:http://groups.google.com/group/google-web-toolkit/browse_thread/thread/77a0eaf8086218a6/effb8d3abe69270b#effb8d3abe69270b
您可以保留列表中列出的列名称列表:
List<String> columnNames = new ArrayList<String>();
table.addColumn(surnameColumn, "surname");
columnNames.add("surname");
// add the other columns
Run Code Online (Sandbox Code Playgroud)
然后,当您需要获取排序列名称时:
String sortColumnName;
ColumnSortList sortList = table.getColumnSortList();
if (sortList != null && sortList.size() != 0){
Column <MyEntity, ?> sortColumn = (Column <MyEntity, ?>)
sortList.get(0).getColumn();
Integer columnIndex = table.getColumnIndex(sortColumn);
sortColumnName = columnNames.get(columnIndex);
}
// do your rpc call
Run Code Online (Sandbox Code Playgroud)
*其中MyEntity是您在单元格表中显示的数据对象.
| 归档时间: |
|
| 查看次数: |
2678 次 |
| 最近记录: |