佳礼资讯网

 找回密码
 注册

ADVERTISEMENT

查看: 1588|回复: 0

求救!需要java高手+wicket framework专家帮忙!

[复制链接]
发表于 17-4-2013 03:54 PM | 显示全部楼层 |阅读模式
最近工作遇到难题难以解决。。需要这方面的高手帮忙解决难题。。不然难以交货。。:(

以下是难题的简单版本。。看有否谁知道怎样去用event trigger+ajax refresh在list view里面的form component.

I have created a list view which will show number of records in table view and inside the listview contains a textfield and a dropdownchoice field.

What I need to achieve is onchange of the textfield to default the value in the dropdownchoice for a particular record. But appears that when using the following codes, when its only 1 record to be updated, it works, but when multiple records exist, it will fail. Need help! Thanks in advance.

Sample Code:
new ListView("list", getItemList()) {
    protected void populateItem(ListItem item) {
        final Sl qv = (Sl) item.getModelObject();
        item.setModel(new CompoundPropertyModel(qv));

        ratio = new TextField("ratio");
        item.add(ratio);
        ratio.setOutputMarkupId(true);

        ratio.add(new AjaxFormComponentUpdatingBehavior("onkeyup") {
            @Override
            protected void onUpdate(AjaxRequestTarget target) {
                getProperties().put("rating" + Sl.getid(), "Strong");
                target.addComponent(rating);
            }
        });

        rating = new DropDownChoice("rating", getDdlmodels().get(item.getIndex()), ratingList);
        item.add(rating);
        rating.setOutputMarkupId(true);
    }
}

Note: PropertyModel with ValueMap properties as key (DdlModels) has been used to get and set value of the dropdownchoice. Upon onchange of the textfield, the propertyModel has been updated, however the dropdownchoice has not been refresh/re-rendered even though I have added for ajax refresh.

I believe its something related to the target.add(rating), which I think can't be refreshed in this way, but I can't find other way.
本帖最后由 ss24 于 17-4-2013 03:57 PM 编辑

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

 

ADVERTISEMENT


本周最热论坛帖子本周最热论坛帖子

ADVERTISEMENT



ADVERTISEMENT

ADVERTISEMENT


版权所有 © 1996-2023 Cari Internet Sdn Bhd (483575-W)|IPSERVERONE 提供云主机|广告刊登|关于我们|私隐权|免控|投诉|联络|脸书|佳礼资讯网

GMT+8, 27-9-2025 02:07 PM , Processed in 0.119090 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表