Question
· May 23, 2017

Horizontal layout in several rows in dynaform

Set dynaform property  layout="horizontal" makes form controls to be shown horizontal in one row.

But how configure dynaform to show controls in several horizontal rows?

Discussion (1)1
Log in or sign up to continue

Generally speaking, the parameters defined in %ZEN.DataModel.objectModelParameters can be used to customize the appearance/behavior/really anything about the controls in a dynaForm. One such parameter is:

/// Optional.
/// id of a group component that the control used for this property
/// should be added to. This provides a way to control layout.<br>
/// If not defined, the control is added directly to the <class>dynaForm</class>.
Parameter ZENGROUP As STRING;

For example, given the model class:

Class DC.Demo.ZenDynaForm.Model Extends %ZEN.DataModel.ObjectDataModel
{

Property FirstName As %String(ZENGROUP = "nameGroup");

Property MiddleInitial As %String(ZENGROUP = "nameGroup");

Property LastName As %String(ZENGROUP = "nameGroup");

Property HomePhone As %String(ZENGROUP = "phoneGroup");

Property CellPhone As %String(ZENGROUP = "phoneGroup");

}

The following <dynaForm> will display the three name fields in one horizontal row, and the two phone fields in another:

Class DC.Demo.ZenDynaForm Extends %ZEN.Component.page
{

/// This XML block defines the contents of this page.
/// Setting XMLNamespace turns on StudioAssist for this XML block.
XData Contents [ XMLNamespace = "http://www.intersystems.com/zen" ]
{
<page xmlns="http://www.intersystems.com/zen">
<dataController id="myController" modelClass="DC.Demo.ZenDynaForm.Model" />
<dynaForm controllerId="myController">
<hgroup id="nameGroup" />
<hgroup id="phoneGroup" />
</dynaForm>
</page>
}

}