File tree Expand file tree Collapse file tree 3 files changed +26
-2
lines changed
src/ansys/dynamicreporting/core/serverless Expand file tree Collapse file tree 3 files changed +26
-2
lines changed Original file line number Diff line number Diff line change @@ -198,7 +198,19 @@ Returns the filter mode of the template. The possible outputs are:
198
198
Sets the filter mode of the template. Takes as input a string. See
199
199
get_filter_mode for the accepted values.
200
200
201
- Example of usage. Let's assume you want to create a template like the
201
+ **template.reorder_child(target_child_template, new_position) **
202
+
203
+ Reorders a child template within the list of children to a specified position.
204
+
205
+
206
+ This method moves a child template (identified by its GUID or the template object itself)
207
+ to a new position within the `children ` list of the current template. It ensures that
208
+ the specified position is valid and that the target child template exists in the `children ` list.
209
+
210
+ Example of Usage
211
+ ^^^^^^^^^^^^^^^^
212
+
213
+ Let's assume you want to create a template like the
202
214
one shown in the picture (from the documentation example in the
203
215
Ansys Dynamic Reporting installer):
204
216
Original file line number Diff line number Diff line change @@ -99,6 +99,9 @@ Common methods include:
99
99
- ``set_property(props_dict) ``: Replace the “properties” dictionary.
100
100
- ``add_property(props_dict) ``: Add/update keys within the “properties” dictionary.
101
101
- ``render(context=None, item_filter="", request=None) ``: Render the template to HTML string.
102
+ - ``to_dict() ``: Returns a JSON-serializable dictionary of the full template tree.
103
+ - ``to_json(filename) ``: Store the template as a JSON file. Only allow this action if this template is a root template.
104
+ - ``reorder_child(target_child_template, new_position_index) ``: Reorder the target template in the `children ` list to the specified position.
102
105
103
106
Template Parameters
104
107
-------------------
@@ -285,6 +288,15 @@ Example: Creating a Nested Template Structure
285
288
results_panel.set_filter(" A|i_tags|cont|section=results;" )
286
289
results_panel.save()
287
290
291
+ Loading Templates from a JSON file
292
+ ----------------------------------
293
+
294
+ You can load a report with multiple templates from an existing JSON file.
295
+
296
+ .. code-block :: python
297
+
298
+ adr.load_templates_from_file(" my_report.json" )
299
+
288
300
Rendering Templates
289
301
-------------------
290
302
Original file line number Diff line number Diff line change @@ -409,7 +409,7 @@ def to_json(self, filename: str) -> None:
409
409
410
410
def reorder_child (self , target_child_template : "Template" , new_position : int ) -> None :
411
411
"""
412
- Reorder the template.guid in parent. children to the specified position.
412
+ Reorder the target template in the ` children` list to the specified position.
413
413
414
414
Parameters
415
415
----------
You can’t perform that action at this time.
0 commit comments