| 86 | |
| 87 | === List-Fields === |
| 88 | |
| 89 | To control which fields appear in list views (and to prescribe the order of the columns), use the {{{list_fields}}}-setting. This setting takes a list of field names of the fields to be displayed: |
| 90 | |
| 91 | {{{ |
| 92 | s3xrc.model.configure(table, |
| 93 | list_fields=["id", "name", "location_id"]) |
| 94 | }}} |
| 95 | |
| 96 | NOTE: If your view uses dataTables (which all default view templates do), then you '''must''' include {{{"id"}}} at the first place to have it working properly. |
| 97 | |
| 98 | For virtual fields, you should provide a tuple of {{{(T("FieldLabel"), "fieldname")}}}, because virtual fields do not have a {{{.label}}} setting (as they are functions and not {{{Field}}} instances): |
| 99 | |
| 100 | {{{ |
| 101 | s3xrc.model.configure(table, |
| 102 | list_fields=[ |
| 103 | "id", |
| 104 | "name", |
| 105 | "location_id", |
| 106 | (T("Total costs"), "total_costs") |
| 107 | ] |
| 108 | }}} |