You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@isis.apache.org by Leandro Torroija <le...@hotmail.com> on 2014/09/02 23:33:34 UTC

CheckBoxes in Lists

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
 		 	   		  

RE: CheckBoxes in Lists

Posted by Leandro Torroija <le...@hotmail.com>.
Working on it. Thank you!!!

Leandro


> From: dan@haywood-associates.co.uk
> Date: Tue, 2 Sep 2014 22:43:35 +0100
> Subject: Re: CheckBoxes in Lists
> To: users@isis.apache.org
> 
> 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 <le...@hotmail.com> 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
> >
 		 	   		  

Re: CheckBoxes in Lists

Posted by Dan Haywood <da...@haywood-associates.co.uk>.
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 <le...@hotmail.com> 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
>