As you saw in the previous section, one of the properties available on the
layoutStrategy, which allows you to completely customize the layout of the fields displayed to the user. It can be 2 things:
- singlecolumn - lays out all fields in a single column.
- twocolumnabab (or simply 'twocolumn') - lays out first field in column A, second in column B, third in column A, fourth in column B, and so forth.
- twocolumnaabb - divides the fields at the mid point and puts the first half in column A, the second in column B.A string representing a preset layout. Currently, there are 3 preset layouts:
- An object containing a single function,
buildLayout, which takes as input a
MixedCollectionof fields received from the server, and is intended to return a config object that will be used to construct the form.
Building off the basic example below is a custom layout that organizes specific fields into 2 columns. Note that
fields is an instance of
Ext.util.MixedCollection, and a function
getFields has been added which has the same behavior as
get, except it returns an empty hidden field if the field is not found, enabling you to use the same layout with multiple views.