Ejemplo listview con listado relacionado

23-06-2019
## En sección ![](/open/scl/uploads/cRB1UHa60CBnHbJeOstx.png) ``` S.addRoute("/admin/amura/activities/activity/:id", args => { let detail = new admin.EntityDetail("amura.activities.activity", { properties: [ "id", { newRow: true }, "image", { newRow: true }, "name", "::other", ] }) detail.renderMoreSectionsFunc = detail => { let section = new S.FormSection(T("@@Campos")) section.addButton("highlighted2", T("@@Nuevo"), () => grid.create()) section.addMenuItem(T("@@Copiar"), "copy", () => grid.copy()) section.addMenuItem(T("@@Eliminar"), "delete", () => grid.delete()) let grid = new admin.EntityGrid("amura.activities.activityField", { id: "activityFields", properties: [ "id", "name", "type", "required" ], filter: { "a.idActivity": detail.model.id, }, createFunc: item => item.idActivity = detail.model.id, detailSkipProperties: [ "idActivity" ], autoLoad: true }) detail.form.element.appendChild(section.element) section.body.appendChild(grid.element) } detail.load(args.id) let view = new admin.AdminView("padding") let tile = new S.Tile() view.content.appendChild(tile.element) tile.element.appendChild(detail.element) S.setView(view) }) ``` ## En pestaña: ![](/open/scl/uploads/SLsu4f2dISv1L1FPhAuR.png) ``` detail.renderTabsFunc = detail => { let tabs = detail.tabs; tabs.add(null, null, T("@@Principal"), () => detail.renderForm()) tabs.add(null, null, T("@@Movimientos"), () => { S.clear(detail.body) let section = new S.FormSection(T("@@Campos")) section.addButton("highlighted2", T("@@Nuevo"), () => grid.create()) section.addMenuItem(T("@@Copiar"), "copy", () => grid.copy()) section.addMenuItem(T("@@Eliminar"), "delete", () => grid.delete()) let grid = new admin.EntityGrid("amura.activities.activityField", { id: "activityFields", properties: [ "id", "name", "type", "required" ], filter: { "a.idActivity": detail.model.id, }, createFunc: item => item.idActivity = detail.model.id, detailSkipProperties: [ "idActivity" ], autoLoad: true }) section.body.appendChild(grid.element) detail.body.appendChild(section.element) }) tabs.updateURL = false S.getJson({ url: "/amura/activities/orm/count.api", data: { entity: "activityField", filter: { idActivity: args.id } }, onSuccess: count => tabs.setCount(1, count) }) } ```

Amura