Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

  • multi select drop down in List Grid

    Hi,
    My SmartGWT version is: SmartClient Version: v11.0p_2017-02-11/PowerEdition Deployment (built 2017-02-11).
    I am using SmartGWT + Spring +Hibernate in my project.
    Below is my Entity which my Grid datasource is pointing to:

    @Entity
    @Table(name = "material_attr")
    public class MaterialAttr {

    /** The material attr id. */
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "material_attr_id")
    @Access(AccessType.PROPERTY)
    private int materialAttrId;

    /** The material prep. */
    @OneToMany(mappedBy ="materialAttr" , fetch = FetchType.EAGER,cascade = CascadeType.ALL)
    private List<MaterialPrep> materialPrep;
    }

    Below is the MaterialPrep Entity:



    @Entity
    @Table(name="material_prep")
    public class MaterialPrep {

    /** The material prep id. */
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name="material_prep_id")
    private int materialPrepId;

    /** The material attr. */
    /*@ManyToOne
    @JoinColumn(name="material_attr_id" , referencedColumnName = "material_attr_id")
    private MaterialAttr materialAttr;*/


    /** The prep id. */
    @ManyToOne
    @JoinColumn(name="prep_id" , referencedColumnName="code_id")
    private Code prepId;

    }

    Below is ds.xml:

    <DataSource ID="MaterialAttr"
    schemaBean="com.assaabloy.pricebook.server.persistence.model.MaterialAttr">
    <field name="materialAttrId" hidden="true" primaryKey="true" />
    <field name="prepCode" valueXPath="materialPreps/prepId/code"
    title="Material Prep" width="150" multiple="true"/>
    </DataSource>



    I want the prepCode field to show comma separated values.
    How can I do that in List Grid?






  • #2
    Hi isomorphic,
    Again posting the query :

    I have a entity 'MaterialAttr' with list of 'MaterialPreps' through reverse hibernate mapping:

    @Entity
    @Table(name = "material_attr")
    public class MaterialAttr {

    /** The material attr id. */
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "material_attr_id")
    @Access(AccessType.PROPERTY)
    private int materialAttrId;

    /** The material prep. */
    @OneToMany(mappedBy ="materialAttr" , fetch = FetchType.EAGER,cascade = CascadeType.ALL)
    private List<MaterialPrep> materialPrep;
    }


    I need help with ds.xml mapping to display materialPreps as comma separated values in grid column.

    I could see hibernate oneToMany documentation : http://www.x-client.com/smartgwtee-r...Relations.html

    but I have reverse mapping in my scenario.
    Could you please help me with ds.xml mapping?



    Comment


    • #3
      Hi preeti_kanyal,

      I solve a similar usecase with a own small DataSource for a 2-column view. A FK to the row where you want to display the content and a column where I LIST_AGG (Oracle) the values.
      I'm pretty sure something similar is possible with Hibernate. If not, just generate the mentioned view in your RDBMS by hand.
      Then includeFrom from the small DataSource.

      Best regards
      Blama

      Comment


      • #4
        Hi isomorphic,
        we are still struggling with multi select grid editor implementation.
        We would like to discuss our issue over a call or webEx.
        Could you please tell how we can get support over the call/WebEx for this particular issue?

        Comment


        • #5
          Our available commercial support and consulting services are explained here.

          Comment

          Working...
          X