Action over selected items on a collection

93 Views Asked by At

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

1

There are 1 best solutions below

0
Dan Haywood On

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