Announcement

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

    Add operation supported by server framework

    Hi
    I have a requirement in which i need to provide the DS name and it should populate all the fields related to that DS and create a dynamic form taking input fields as fields from DS
    I am doing something like this:

    vendorDialogForm = new DynamicForm();
    vendorDataSource = DataSource.get(ClientConstants.VENDOR_DS);
    vendorDialogForm.setDataSource(vendorDataSource);
    vendorDialogForm.fetchData();

    and this is how my DS looks like:

    <DataSource ID="Vendor" serverType="hibernate"
    autoDeriveSchema="true"
    schemaBean="com.assaabloy.pricebook.server.persistence.model.Vendor"
    beanClassName="com.assaabloy.pricebook.server.persistence.model.Vendor"
    configBean="priceBookSessionFactory">

    <fields>
    <field name="vendorId" primaryKey="true" type="sequence" hidden="true" />

    <field name="abbr" required="true" type="text" />

    </fields>

    </DataSource>


    Logs shows the select HQL from vendors table when this is triggered

    [INFO] [qtp1249985-35] com.isomorphic.hibernate.HibernateDataSource - [builtinApplication.Vendor_fetch] Query string: select _Vendor from com.assaabloy.pricebook.server.persistence.model.Vendor _Vendor
    Hibernate: select vendor0_.vendor_id as vendor_i1_42_, vendor0_.Abbr as Abbr2_42_, vendor0_.Address1 as Address3_42_, vendor0_.Address2 as Address4_42_, vendor0_.Address3 as Address5_42_, vendor0_.audit_user_id as audit_us6_42_, vendor0_.business_unit as business7_42_, vendor0_.Cell as Cell8_42_, vendor0_.City as City9_42_, vendor0_.contact_id as contact22_42_, vendor0_.Country as Country10_42_, vendor0_.DOT_Flag as DOT_Fla11_42_, vendor0_.Email as Email12_42_, vendor0_.Fax as Fax13_42_, vendor0_.IS_DELETED as IS_DELE14_42_, vendor0_.Name as Name15_42_, vendor0_.Notes as Notes16_42_, vendor0_.order_url as order_u17_42_, vendor0_.Phone as Phone18_42_, vendor0_.State as State19_42_, vendor0_.vendor_type_id as vendor_23_42_, vendor0_.web_url as web_url20_42_, vendor0_.Zip as Zip21_42_ from vendor vendor0_

    but what it does is , it prefills the value fetched as first row from the database into the form and treats that as an update request

    What is required is , a blank form getting fields from DS and an add operation to be triggered.

    Please advice.

    Thanks

    #2
    You're calling fetchData(), so your results are entirely expected.

    See the doc for DynamicForm.editNewRecord() and it links.

    Comment

    Working...
    X