简体   繁体   English

GWT CellTable中的有趣行为?

[英]Funny Behaviour in GWT CellTable?

I've created a test case of my CellTable issue as a self contained panel that can easily be imported into any project: 我已经创建了一个关于CellTable问题的测试用例,作为一个独立的面板,可以轻松地将其导入任何项目中:

http://pastebin.com/zDLPKUNh http://pastebin.com/zDLPKUNh

I've also posted this question on Google Groups GWT discussions. 我还在Google网上论坛GWT讨论中发布了此问题。

Basically I have two Date class fields in my row model, a startDate and an endDate. 基本上,我的行模型中有两个Date类字段,一个startDate和一个endDate。 Each Date has two columns in the CellTable (called batchTable), one to display the actual date (a DatePickerCell) and the other being a text input cell for the time. 每个日期在CellTable中都有两列(称为batchTable),一列用于显示实际日期(DatePickerCell),另一列是该时间的文本输入单元格。

When the FieldUpdater of the startTime or endTime is fired we parse the value, save the new time and call batchTable.setRowData() with the updated object and row index. 当启动startTime或endTime的FieldUpdater时,我们解析该值,保存新时间,并使用更新的对象和行索引调用batchTable.setRowData()。

The problem is that when FieldUpdater is fired, the cells do not update? 问题在于,当触发FieldUpdater时,单元格不会更新吗?

I specifically edited the FieldUpdater of the endTime cell to be an hour later than what it was set at. 我专门将endTime单元的FieldUpdater编辑为比设置的时间晚一个小时。

I've checked as best as I can that all the gets and sets of the respective startDate and endDate are in order, but I'm thinking that there's something about CellTable I'm not getting. 我已尽力检查了各个startDate和endDate的所有获取和设置是否正确,但我认为CellTable方面有些问题。

Apologies if I've missed anything. 抱歉,如果我错过任何事情。

I'm running: GWT 2.3 我正在运行:GWT 2.3

I've tested it in the latest Chrome and IE9. 我已经在最新的Chrome和IE9中对其进行了测试。

Regards, 问候,

Julian 朱利安

I faced the same problem. 我遇到了同样的问题。 In my case I had visiblerange set incorrectly. 就我而言,我的visiblerange设置不正确。 First parameter is index and second parameter is length. 第一个参数是索引,第二个参数是长度。 Make sure those two are set up correctly. 确保这两个设置正确。 After that the cell table displays correctly. 之后,单元格表将正确显示。 I did not need to call redraw. 我不需要致电重绘。

According to the google docs it should be enough to just change the field in your object and then call 根据google文档 ,只需更改对象中的字段然后调用即可

cellTable.redraw();

in the update() method. 在update()方法中。

You could also try to call setRowData on your ListDataProvider instead of your CellTable. 您也可以尝试在ListDataProvider而不是CellTable上调用setRowData。 However calling setRowData on the ListDataProvider would probably end up in a call to every added display of the ListDataProvider which would be the same as calling setRowData on the CellTable directly. 但是,在ListDataProvider上调用setRowData可能会最终导致对ListDataProvider的每个添加显示的调用,这与直接在CellTable上调用setRowData相同。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM