| | 141 | |
| | 142 | === Sorting of Inline-Components ==== |
| | 143 | |
| | 144 | It is possible to sort the inline-items by specifying an {{{orderby}}} option: |
| | 145 | |
| | 146 | {{{ |
| | 147 | s3forms.S3SQLInlineComponent( |
| | 148 | "location", |
| | 149 | label = T("Countries"), |
| | 150 | fields = ["location_id"], |
| | 151 | orderby = "location_id$name" |
| | 152 | ), |
| | 153 | }}} |
| | 154 | |
| | 155 | To specify the sort order, the {{{orderby}}}-option also accepts a tuple like: {{{("location_id$name", "desc")}}}. |
| | 156 | |
| | 157 | '''Note:''' the field selector used in orderby must give exactly one value per row (i.e. use only forward-links, not component fields or list:types), otherwise the same component item would appear multiple times in the form (due to the left join involved). |