简体   繁体   中英

Action over selected items on a collection

I'm developing an application using Apache Isis and I didn't find any examples on how to present a collection (list of items), allow the user to select only some of them, and to execute an Action which will be applied only to the SELECTED ones.

Is it possible to be done? Any suggestion?

Thanks

Your use case is, in fact, supported: you need to use @Action(associateWith=...), see [1].

For example, suppose we have a "removeItems(…)" action:

public class Order {

    @Collection
    SortedSet<OrderItem> getItems() { ... }

    ...

    @Action(associateWith="items", associateWithSequence="2")
    public Order removeItems(SortedSet<OrderItem> items) { ... }
}

The Wicket viewer will then render the "items" collection with checkboxes, and any selected items will be used as the pre-selected set of items if the action is invoked

HTH Dan

[1] http://isis.apache.org/guides/rgant/rgant.html#_rgant-Action_associateWith

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM