On 16 March 2015 at 12:34, Victor Oomens <[email protected]> wrote:

> Well, it's actually a regular action that applies on the current view or
> list of objects. I would like a button for the listed objects (e.g. the
> show / hide / sum buttons), that would trigger an action that returns a
> clob.
>
> So far I've used the bulk action with isLast() to generate the zip file.
> But that button only appears on the detail pages of a single object.
>

Um, that's not accurate.

Bulk actions are only rendered for "standalone" collections of objects, ie
as the result of executing an action that returns a List<Foo>.

The other type of collection we support are "parented" collections, ie that
belong to a single entity.

This can be either explicit eg:

   public class Order {  public SortedSet<OrderItem> getItems(){ ... } }

or can be a contributed collection:

   public class Order { ... }

@DomainService
public class OrderItemContributions {    public List<OrderItem> items(Order
order) { ... } }

At any rate, for either type of parented collection does NOT (currently)
support bulk actions.... there are no toggle boxes to select one or several
and apply an object to just those.

~~~
However, parented collections DO allow (regular) actions to be associated
with them, such that these actions appear in the panel above the
collection.  This can be done using either the @MemberOrder annotation
[1,2], or done using the .layout.json file for the entity [3].

An example of the latter (recommended) approach can be seen in the example
todoapp, eg [4]

HTH
Dan

[1] http://isis.apache.org/reference/recognized-annotations/MemberOrder.html
[2] http://isis.apache.org/components/viewers/wicket/static-layouts.html
[3] http://isis.apache.org/components/viewers/wicket/dynamic-layouts.html
[4]
https://github.com/isisaddons/isis-app-todoapp/blob/61b8114a8e01dbb3c380b31cf09eaed456407570/dom/src/main/java/todoapp/dom/module/todoitem/ToDoItem.layout.json#L196





>
>
> > Op 16 mrt. 2015, om 12:30 heeft Dan Haywood <
> [email protected]> het volgende geschreven:
> >
> > Glad you've made progress... but I'm just wondering as to which of the
> two
> > answers we gave were useful.
> >
> > When you say "bulk action", are you meaning an action that gets applied
> to
> > multiple objects in a list (with checkboxes), as per Jeroen and my first
> > answer.
> >
> > Or are you merely meaning a regular action that returns a Blob or Clob?
> > (as per my second answer).
> >
> > ~~~
> > When we know that, can probably answer this next question of yours.
> >
> > Thx
> > Dan
> >
> >
> >
> >
> > On 16 March 2015 at 11:20, Victor Oomens <[email protected]> wrote:
> >
> >> Thx guys,
> >>
> >> I've managed to create a bulk action in the domain object class. How
> can I
> >> get the actual button in the list view?
> >>
> >> Victor.
> >>
> >>
> >>> Op 16 mrt. 2015, om 10:40 heeft Dan Haywood <
> >> [email protected]> het volgende geschreven:
> >>>
> >>> Also... a "bulk download" actually doesn't (necessarily) have to relate
> >> to
> >>> a collection of objects.. you can simply have an action that returns a
> >> Blob
> >>> or a Clob.
> >>>
> >>> A couple of good examples can be found in the devutils isisaddons
> module
> >>> [1], eg [2] and [3]
> >>>
> >>> HTH
> >>> Dan
> >>>
> >>> [1] https://github.com/isisaddons/isis-module-devutils
> >>> [2]
> >>>
> >>
> https://github.com/isisaddons/isis-module-devutils/blob/master/dom/src/main/java/org/isisaddons/module/devutils/dom/DeveloperUtilitiesServiceProgrammatic.java#L163
> >>> [3]
> >>>
> >>
> https://github.com/isisaddons/isis-module-devutils/blob/master/dom/src/main/java/org/isisaddons/module/devutils/dom/DeveloperUtilitiesServiceProgrammatic.java#L178
> >>>
> >>>
> >>> On 15 March 2015 at 11:31, Dan Haywood <[email protected]>
> >> wrote:
> >>>
> >>>> IIRC, all results except the last are ignored.
> >>>>
> >>>> So I think this processing should be when isLast(), not isFirst().
> >>>>
> >>>> Cheers,
> >>>> Dan
> >>>> On 15 Mar 2015 11:24, "Jeroen van der Wal" <[email protected]>
> wrote:
> >>>>
> >>>>> Hi Victor,
> >>>>>
> >>>>> You can take a look at Bulk Interaction [1]. This allows the user to
> >>>>> invoke
> >>>>> an action on selected entries.
> >>>>>
> >>>>> Something like this:
> >>>>>
> >>>>>   @Action(invokeOn=InvokeOn.COLLECTION_ONLY)
> >>>>>   public Blob downloadAsZip() {
> >>>>>       if (actionInvocationContext.isFirst()){
> >>>>>           for (Object party :
> >>>>> actionInvocationContext.getDomainObjects()){
> >>>>>               //put the stuff in a zip
> >>>>>               ...
> >>>>>           }
> >>>>>       }
> >>>>>       return new Blob("dowload.zip", "application/zip", ...)
> >>>>>   }
> >>>>>
> >>>>> Cheers,
> >>>>>
> >>>>> Jeroen
> >>>>>
> >>>>> [1] https://isis.apache.org/reference/services/bulk-interaction.html
> >>>>>
> >>>>> On 14 March 2015 at 15:20, Victor Oomens <[email protected]>
> wrote:
> >>>>>
> >>>>>> Hi all,
> >>>>>>
> >>>>>> Perhaps someone could give me a pointer on how to create a 'bulk
> >>>>> download'
> >>>>>> action button when listing records with attachments. I would like to
> >>>>> create
> >>>>>> a zip file of all the attachments of the listed records for the user
> >> to
> >>>>>> download at once.
> >>>>>>
> >>>>>> TIA.
> >>>>>>
> >>>>>> Victor
> >>>>>
> >>>>
> >>
> >>
>
>

Reply via email to