如何从wicket文本字段/模型获取更新值 final TextField regularPrice=new TextField(“常规”,新属性模型(listItem.getModel(),“价格”)) { 私有静态最终长serialVersionUID=1L; @凌驾 配置()上受保护的空 { super.onConfigure(); 设置已启用(cashflowStatus.compareTo(cashflowStatus.M_手动)
我希望在更改时获得新的更新值,但我正在从模型中获取旧值。模型没有更新,它应该给出新的更新值。请让我知道,上述代码中出现了什么错误,以及如何获得更新值?您还应该重新渲染组件:)如何从wicket文本字段/模型获取更新值 final TextField regularPrice=new TextField(“常规”,新属性模型(listItem.getModel(),“价格”)) { 私有静态最终长serialVersionUID=1L; @凌驾 配置()上受保护的空 { super.onConfigure(); 设置已启用(cashflowStatus.compareTo(cashflowStatus.M_手动),wicket,wicket-6,Wicket,Wicket 6,我希望在更改时获得新的更新值,但我正在从模型中获取旧值。模型没有更新,它应该给出新的更新值。请让我知道,上述代码中出现了什么错误,以及如何获得更新值?您还应该重新渲染组件:) final TextField<Double> regularPrice = new TextField<Double>("regular", new PropertyModel<Double>(listItem.getModel(), "price")) { private s
final TextField<Double> regularPrice = new TextField<Double>("regular", new PropertyModel<Double>(listItem.getModel(), "price"))
{
private static final long serialVersionUID = 1L;
@Override
protected void onConfigure()
{
super.onConfigure();
setEnabled(cashflowStatus.compareTo(CashflowStatus.M_MANUAL) < 0);
}
};
listItem.add(regularPrice);
regularPrice.add(new AjaxFormComponentUpdatingBehavior("onChange")
{
private static final long serialVersionUID = 1L;
@Override
protected void onUpdate(AjaxRequestTarget target)
{
Double updatedValue = listItem.getModelObject().getPrice());
}
});
@Override
protected void onUpdate(AjaxRequestTarget target)
{
Double updatedValue = listItem.getModelObject().getPrice());
target.add(this.getComponent());
}