EntityDetail: dynamic list section

27-11-2018
This is an example of how to dynamically add a section to a detail based on some condition. ![](/open/scl/uploads/12SX2NTk8sQMR6oEo9kE.png) Adding a renderModeSections function and some logic it can be customized to show a related list section dynamically: ```typescript S.addRoute("/admin/amura/customfields/field/:id", args => { let entityDetail = new admin.EntityDetail("amura.customfields.field") entityDetail.load(args.id); entityDetail.renderMoreSectionsFunc = detail => { let model = detail.model as Field; if (model.type != FieldType.picklist) { return } let section = new S.FormSection(T("@@Lista de opciones")); section.addMenuItem(T("@@Copiar"), "copy", () => grid.copy()) section.addMenuItem(T("@@Eliminar"), "delete", () => grid.delete()) let grid = new admin.EntityGrid("amura.customfields.item", { properties: ["id", "name"], filter: { "a.idField": model.id }, showModalDetail: true, autoLoad: true, showCheckboxes: true, createFunc: model => { model.idField = detail.model.id // the parent field }, createdModal: detail => { detail.form.getCell("idField").element.style.display = "none" } }) section.addButton("highlighted2", T("@@Nuevo"), () => grid.create()); detail.body.appendChild(section.element) section.body.appendChild(grid.element) } let view = new admin.AdminView("padding"); let tile = new S.Tile(); view.content.appendChild(tile.element); tile.element.appendChild(entityDetail.element); S.setView(view); }) ```
CRUD