Wicket and complex Ajax scenarios

后端 未结 5 1108
抹茶落季
抹茶落季 2020-12-19 16:37

When a screen has multiple interacting Ajax controls and you want to control the visibility of components to react to these controls (so that you only display what makes sen

5条回答
  •  我在风中等你
    2020-12-19 16:58

    When I'm creating components for a page I tend to add them to component arrays:

    Component[] pageComponents = {
                      new TextField("Field1"),
                      new TextField("Field2"),
                      new TextField("Field3")
    }
    

    As of Wicket 1.5 the add functions take array parameters [1]. Therefore elements can be added to the page or target like this:

    add(pageComponents);
    target.add(pageComponents);
    

    Components can then be grouped based on which you want to refresh together.

    [1] http://www.jarvana.com/jarvana/view/org/apache/wicket/wicket/1.5-M3/wicket-1.5-M3-javadoc.jar!/org/apache/wicket/ajax/AjaxRequestTarget.html

提交回复
热议问题