OrangeScape Developer Community

A community for Application Developers on OrangeScape's Platform-as-a-Service

To display child(One-to-Many) records from left to right instead of top to bottom

In general case, while adding One-to-Many record, it will display from top to bottom based OrderBy value. To display the record from left to right, we have to capture the form design output and render left to right.

 

We have to remove the header and footer column from One-to-Many form while design.

To display column heading, we have to design the header column values in the parent form itself look like top to bottom as shown in the figure.

 

To display the data column values, add One-to-Many form cell, in that cell, add gird with your fields. We have to design the Gird along with fields similar to header column designed. We will use the added gird id in the code.

 

Now we have to capture the 1-m form output and display the data, left to right using JSTL code. To capture the form design output, we need few parameter values.

  • Child connection reference cell name (refconn)
  • Child model name (childmodel)
  • OrderBy cell (CreatedAt)
  • Connection reference cell id (Cee79e8aa93b874b7bb3b2acfc63c9c77c)
  • Child model id (Shdea946338ac04efd96a61e04954d5ef1)
  • Gird id designed in One-to-Many form cell (Gr610b3c7371b04812834e5b4e5908dad6)

 

You can find ids (Reference cell id, Child model id, and Designed One to Many form grid id) by Inspect the corresponding element. For example while using studio in firebox browser, right click in the grid (designed in the One to Many cell), get the grid id using firebug and its look like - 'Gr610b3c7371b04812834e5b4e5908dad6_img'. Exclude the '_img' and use the id.

 

By using those parameter values, we have to write the code to display form.

----------------------------------------------------------------------------------------------------------------------------------------

 <table cellspacing="0" cellpadding="0">

  <tr>

   {for instance in getOneToManySheetList(inst,'refconn.childmodel','CreatedAt',false)}

    {var relationUrl = refUrl+"/Cee79e8aa93b874b7bb3b2acfc63c9c77c/Shdea946338ac04efd96a61e04954d5ef1/"

                                       +instance.getValue('SheetId')}

    <td>

     ${childmodel_Gr610b3c7371b04812834e5b4e5908dad6(instance, permission, relationUrl)}

    </td>

   {/for}

  </tr>

 </table>

----------------------------------------------------------------------------------------------------------------------------------------

     In this code, we are getting all the child records using 'getOneToManySheetList' function by passing four parameters. First one is `inst`, second one is `Child connection reference cell name`, third one is `OrderBy cell value`, and fourth one is `true/false for ASC/DESC order`.

     Inside FOR loop, we are composing relation url (refUrl+"/Connection reference cell id/Child model id"+SheetId of each instance).

     For each child instance, it will create one tabledata(<td>) along with form design for each child record.

 

After code compose, make it, code in the single line, and the paste it, in the parent form design(in which place you want to display child records).

 

In Studio form, it will look like,

 

Finally, you will get the child records showing from `left to right` instead of `top to bottom`.

In runtime, while adding record, it will put on view like,

 

Views: 97

Comment

You need to be a member of OrangeScape Developer Community to add comments!

Join OrangeScape Developer Community

© 2017   Created by OrangeScape Technologies.   Powered by

Badges  |  Report an Issue  |  Terms of Service