【问题标题】:Action over selected items on a collection对集合中选定项目的操作
【发布时间】:2025-12-21 21:55:10
【问题描述】:

我正在使用 Apache Isis 开发应用程序,但我没有找到任何关于如何呈现集合(项目列表)、允许用户仅选择其中一些以及执行操作的示例仅适用于 SELECTED 个。

有可能吗?有什么建议吗?

谢谢

【问题讨论】:

    标签: java apache isis


    【解决方案1】:

    实际上,您的用例是受支持的:您需要使用 @Action(associateWith=...),请参阅 [1]。

    例如,假设我们有一个“removeItems(…)”操作:

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

    然后,Wicket 查看器将使用复选框呈现“项目”集合,如果调用该操作,任何选定的项目都将用作预先选择的项目集

    HTH 丹

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

    【讨论】: