| 109 | | Where multiple sub-forms for the same component (e.g. with different filters) shall be embedded, they must each have a distinct "name" argument. (Filtering is not implemented yet - but will come soon). Otherwise this argument is optional. |
| | 109 | To filter an inline component by e.g. type, you can a {{{filterby}}} option like in: |
| | 110 | |
| | 111 | {{{ |
| | 112 | S3SQLInlineComponent( |
| | 113 | "contact", |
| | 114 | name="email", |
| | 115 | label=T("Email Addresses"), |
| | 116 | fields=["value"], |
| | 117 | filterby = dict( |
| | 118 | field = "contact_method", |
| | 119 | options = "EMAIL" |
| | 120 | ) |
| | 121 | ), |
| | 122 | }}} |
| | 123 | |
| | 124 | The filterby settings is a dict (or a list of dicts for multiple filters), containing: |
| | 125 | |
| | 126 | ||'''Attribute'''||'''Explanation'''|| |
| | 127 | ||field||the name of field to filter by|| |
| | 128 | ||options||the allowed options for this field, a single value or a list of values|| |
| | 129 | ||invert||True to invert this filter (default False)|| |
| | 130 | ||default||default value for this field (if only one option is given and invert is False, then that option will automatically be the default value - unless you specify something else)|| |
| | 131 | |
| | 132 | Where multiple sub-forms for the same component (but with different filters) shall be embedded, they must each have a distinct "name" argument. Otherwise this argument is optional. |