Menu

Delete from a record from a collection

Francis
2017-03-17
2017-03-17
  • Francis

    Francis - 2017-03-17

    Hie everyone

    I working on a project which requires deletion of a record from a collection.I would like to mark the row with the record to be deleted and click on a delete button to delete the record.I have considered the RemoveSelectedInCollectionAction.java in openxava to help me out.However, if I use the action Iget this error

    Impossible to execute Completed action: It's required that the View represents a collection in order to call method getCollectionSelectedValues()

    This is my class

    package org.openxava.billing.model;

    import java.math.;
    import java.util.
    ;

    import javax.persistence.*;

    import org.openxava.annotations.;
    import org.openxava.billing.actions.
    ;
    import org.openxava.billing.annotations.;
    import org.openxava.billing.model.Bilmat.
    ;
    import org.openxava.billing.model.DiaryDetails;

    @Entity
    @Table(schema="cli", name="matdet")
    //@Tab(properties="bilmat.matid, bilmat.mdesc")
    @View(members="MatterDescription ["+
    "matid;" +
    " ]
    ;" +
    "details"
    )

    public class DiaryEnquiry {

    @Id 
    //@Hidden
    @SearchKey
    @Column(length=15)
    public String matid;
    
    /*
    @NoModify
    @NoCreate
    @ReferenceView("DiaryEnquiry")
    @OnChange(OnChangeForDiaryEnquiry.class)
    @ManyToOne(fetch=FetchType.LAZY, optional=true)
    private Bilmat bilmat;
    */
    
    //@ReadOnly
    @OneToMany(mappedBy="parent", cascade=CascadeType.ALL)
    @ListProperties("drydte,drycod,drydesc")
    private Collection<DiaryDetails> details = new ArrayList<DiaryDetails>();
    
    public String getMatid() {
        return matid;
    }
    
    public void setMatid(String matid) {
        this.matid = matid;
    }
    
    public Collection<DiaryDetails> getDetails() {
        return details;
    }
    
    public void setDetails(Collection<DiaryDetails> details) {
        this.details = details;
    }
    

    }

    Any help is well appreciated

    Thanks regards

     
  • Javier Paniza

    Javier Paniza - 2017-03-20

    Hi Francis,

    Maybe I don't understand well, but the feature you're developing are provided by OpenXava out-of-the-box.


    Help others in this forum as I help you.

     

Log in to post a comment.