142 | | The optional '''rheader''' argument helps you to display some information about the primary resource record in the view while operating on a component (e.g. the person's name and ID, when displaying a list of available images for this person). You may pass static content, or a function or lambda to produce content, which will be forwarded as ''rheader'' variable to the view. If rheader is a function or lambda, then it will be called with the current S3Request ("r") as the only argument. |
143 | | |
144 | | The tabs functionality is to be implemented by the respective rheader function, it is not generated by the REST controller. |
| 142 | The optional '''rheader''' argument helps you to display some information about the primary resource record in the view while operating on a component (e.g. the person's name and ID, when displaying a list of available images for this person). You may pass static content, or a function or lambda to produce content, which will be forwarded as ''rheader'' variable to the view. |
| 143 | |
| 144 | If for rheader a function or lambda is specified, then it will be called with the current S3Request ("r") as the only argument. Otherwise, rheader is passed to the view as-is. |
| 145 | |
| 146 | The tabs functionality as in the example is to be implemented by the respective rheader function. This can make use of the helper function shn_rheader_tabs(), which renders tabs into the rheader to enable easy navigation through the resource and its components. |
149 | | |
150 | | If you pass a function or lambda as rheader, then it has to take 5 arguments: |
151 | | - '''resource''' = name of the primary resource |
152 | | - '''record_id''' = id of the primary resource record |
153 | | - '''representation''' = data format of the request |
154 | | - '''next=None''' = backlink URL to reproduce the request (with empty method) |
155 | | - '''same=None''' = backlink URL to reproduce the request (with empty method and containing the string '[id]' instead of the primary resource record id) |
156 | | |
157 | | The backlinks can be used to reproduce the original request after doing something on the primary resource (e.g., edit or change the selected record). |