Vaadin TextChangeListener、表格和焦点丢失
我需要一些帮助来解决由TextChangeListener更新的计算问题 所以我有一个DTO,它包含数量和单价。 在我的表中,我添加了一个额外的列,其值为数量*单价 使用TextChangeListener,我想更新列“Montant Total”的值。 在listener中,我这样做:Vaadin TextChangeListener、表格和焦点丢失,vaadin,Vaadin,我需要一些帮助来解决由TextChangeListener更新的计算问题 所以我有一个DTO,它包含数量和单价。 在我的表中,我添加了一个额外的列,其值为数量*单价 使用TextChangeListener,我想更新列“Montant Total”的值。 在listener中,我这样做: // I commit the change myTable.commit(); // I need to refresh the row cache myTable.refreshRowCache();
// I commit the change
myTable.commit();
// I need to refresh the row cache
myTable.refreshRowCache();
如果调用“refreshRowCache()”,更改将完成,但我在字段中失去焦点。。。
如果我不调用该方法,显然列的值不会改变。在vaadin论坛的帖子中解释了您需要做什么我使用myTextField.getCursorPosition()和myTextField.setCursorPosition来解决这个问题