Menu

who works selectionField ?

Developers
2010-05-20
2013-04-29
  • Nobody/Anonymous

    Hallo everyone,

    i want to make a SelectionField in my application.

    but it doesn't work correctly.  Have anyone an idea, what i did worg?

    @ViewField(render=ViewConstants.RENDER_SELECT, label="Status", selectionField="status" )
    public LIst<String> status = new ArrayList<String>();
    ……………………………………………………….
    public List<String> getStatus()
    {
        if (status ==null)
       {
           status = new ArrayList<String>();
           status.add("yes")
           status.add("no")
       }
       return status;
    }
    …………………………………………………………………….
    public void setStatus(List<String> status){
         this.status = status
    }
    …………………………………………………………………..

    thanks very much.

     
  • Luca Garulli

    Luca Garulli - 2010-05-20

    Hi,
    the selectionField must indicate a field (or just getter/setter) that keep the selection. When you use Arrays and Collections the selection is the entry inside of it. In your example the user choose a status and the selected status will be available inside the property indicated in the selectionField.

    @ViewField(render=ViewConstants.RENDER_SELECT, label="Status", selectionField="status" )
    public LIst<String> statuses = new ArrayList<String>();
    @ViewField(visible=AnnotationConstants.FALSE)
    public String status;
    ................................................................
    public List<String> getStatuses()
    {
      if (statuses ==null){
        statuses = new ArrayList<String>();
        statuses.add("yes")
        statuses.add("no")
      }
      return statuses;
    }
    ...............................................................................
    public String getStatus(){ return status; }
    public void setStatus( String  status){ this.status = status }
    

    It's the same for all the components rendered with multivalues such as Tab, List, Table, etc.

    Enjoy with Roma!

    bye,
    Luca Garulli

     

Log in to post a comment.