You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/development-guide/user-interface/developing-ui-tables.md
+36-1Lines changed: 36 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -74,11 +74,17 @@ Finally, call the table `render` method to produce html. Pass the data table to
74
74
75
75

76
76
77
+
## 2-level header
78
+
79
+
You can create groups of columns with `define_column_group`. See an example in `zcl_abapgit_gui_page_whereused` class. `title` and `id` are both options, but you have to start before the first column if you plan to use groups (because it calculates spans from start).
80
+
81
+

82
+
77
83
## CSS styles
78
84
79
85
There are several options to styling your table:
80
86
81
-
- First, you can pass the element id, and css class of the table itself to the `render` method.
87
+
- First, you can pass the element id, and css class of the table itself to the `render` method.
82
88
- Passing `iv_wrap_in_div` parameter will wrap your table in another `div` with the given css class name, primarily for visual styling purposes (e.g. see padded borders and rounded corners in the screenshot below).
83
89
84
90
There are default CSS styles in abapGit to reuse if you don't want to bother with any specific styling - `default-table` and `default-table-container`, respectively, for the wrapping `div`.
If you use 2-level header and pass `iv_group_id` it will also appear as a `data-gid` attribute in all relevant cells.
163
+
156
164
## Cell rendering
157
165
158
166
You can define your column so that the `column_id` and the field to take a value from have different names. In the example below the `iv_value` in `render_cell` will be taken from the `person_id` field in the table structure.
@@ -203,3 +211,30 @@ Technical-wise sorting markers are links with events defined like `sapevent:sort
203
211
```
204
212
205
213
... and then applying the `ms_sorting_state` elsewhere before rendering the table
214
+
215
+
### In-table sorting
216
+
217
+
This feature is **experimental**, use with care. See `zcl_abapgit_gui_page_whereused` as an example.
218
+
219
+
To simplify sorting handling you may create your table component as a class member, and pass `is_initial_sorting_state`.
220
+
221
+
```abap
222
+
DATA ls_sorting_state TYPE zif_abapgit_html_table=>ty_sorting_state.
223
+
ls_sorting_state-column_id = 'xyz'.
224
+
mi_table = zcl_abapgit_html_table=>create(
225
+
is_initial_sorting_state = ls_sorting_state ).
226
+
```
227
+
228
+
In the event handling method use `process_sorting_request` instead of `detect_sorting_request`.
229
+
230
+
```abap
231
+
IF mi_table->process_sorting_request( ii_event->mv_action ) = abap_true.
With this approach you will not need any other sorting logic to implement the table component will handle sorting for you. Please mind the caveats though:
238
+
239
+
- The `column_id` (or supplied `from_field`) **must** exist as a table field (for sortable columns)
240
+
- To do the sorting the component creates a copy of the data internally. Mind memory consumption.
0 commit comments