It is possible, yes, through @Bulk actions.
There are a couple of limitations:
- bulk actions can only be applied for standalone collections
- bulk actions cannot take arguments
- bulk actions cannot have validation rules (the action invocation must
guard against/ignore an invalid request)
For example:
@DomainService
public class Students {
List<Student> findStudents(...) { ... returns the list ... }
}
public class Student {
@Bulk
public void recordAttendance() { ... }
}
~~~~~
For your particular use case the above might not be sufficient... how does
the Student know what Course it is attending? Normally one might pass in a
parameter to the action, but - as noted above - bulk actions currently
don't allow that.
As a work-around, you could instead return a view model that wraps the
Student as well as holding any other context, eg the Course:
@DomainService
public class StudentAttendances {
List<StudentAttendance> findStudentsToAttend(Course course) { ...
returns the list of StudentAttendance view models... }
}
public class StudentAttendance implements ViewModel {
private Student student;
private Course course;
viewModelInit(String str) { ... }
viewModelMemento() { ... }
@Bulk
public void recordAttendance() { ... do something with this.student
and this.course ... }
}
The above is, admittedly, a bit byzantine, but ought to work.
HTH
Dan
On 2 September 2014 22:33, Leandro Torroija <[email protected]> wrote:
> Hi all,
> I need to check two properties of Boolean type in several objects at once.
> Some true, some false. I have no idea how to do it from Isis. Is it
> possible to enable checkboxes in a list? Is there another way to do it?
> (What I want to do is to record the attendance of students)
>
> Cheers,
> Leandro
>