Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ajax/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Wicket ajax更新组件行为?_Ajax_Wicket - Fatal编程技术网

Wicket ajax更新组件行为?

Wicket ajax更新组件行为?,ajax,wicket,Ajax,Wicket,我已经覆盖了DefaultDataTable中的rowitem,以添加一些onClick行为 @Override protected Item newRowItem(String id, int index, IModel model) { //return super.newRowItem(id, index, model); final Item<SearchResult> rowItem = su

我已经覆盖了DefaultDataTable中的rowitem,以添加一些onClick行为

        @Override
        protected Item newRowItem(String id, int index, IModel model) {
             //return super.newRowItem(id, index, model);
            final Item<SearchResult> rowItem = super.newRowItem(id, index,model);
            rowItem.add(new AjaxEventBehavior ("onclick") {
               @Override
               protected void onEvent(AjaxRequestTarget target){
                  WebMarkupContainer wmc = new WebMarkupContainer("myTest");
                  target.add(wmc); //this doesn't work
                  add(wmc); //works but only when I refresh the page
               }
            });
            return rowItem;
        }

        <object wicket:id="myTest" data="" border="1" width="100%" height="600px"></object>
但这似乎没有帮助

我怎样才能使用户不必刷新页面


我刚开始使用Wicket和Ajax,所以我是个初学者。

您应该将原始容器添加到AjaxRequestTarget,而不是创建一个新容器。确保容器使用动态模型,以便在通过AJAX重画组件时实际更新值。

因此,我必须将原始容器设置为字段?它可以将容器设置为字段。我不知道这是否是正确的方法?您可以将其作为最终的局部变量,并在内部类中引用它。
         wmc.setOutputMarkupId(true);