sections.dynaform.nestedModel.xhtml Maven / Gradle / Ivy
The newest version!
This example demonstrates how to use nested model. You can picture it as a table contained in a cell. This is very useful when your control is a combination of pe:dynaFormControl. Note, XHTML code with pe:dynaForm stays the same, only Java model gets changed. Main steps:
- Create parent model instance: DynaFormModel model = new DynaFormModel();
- Add row, label, control and set relationship as you would do in normal case,
- Create nested model instance: DynaFormModel nestedModel = new DynaFormModel();
- Add row to regular grid: DynaFormRow nestedRow = nestedModel.createRegularRow();
- Add label, control and set relationship as usual,
- Add nested model: nestedRow.addModel(data, type, colspan, rowspan);
${showcase:getFileContent('/sections/dynaform/example-nestedModel.xhtml')}
${showcase:getFileContent('/org/primefaces/extensions/showcase/controller/dynaform/NestedDynaFormController.java')}
${showcase:getFileContent('/org/primefaces/extensions/showcase/model/dynaform/BookProperty.java')}