Empty tables in HTML forms (#4658)

Previously if there were no data rows, it would render just the column headers of the table. 

After this change, it shows "Not available".

Co-authored-by: Lars Hvam <larshp@hotmail.com>
This commit is contained in:
Marc Bernard 2021-03-23 06:49:04 +01:00 committed by GitHub
parent 1104c88e48
commit 18c9b404f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -644,6 +644,11 @@ CLASS zcl_abapgit_html_form IMPLEMENTATION.
ii_html->add( is_attr-error ).
ENDIF.
lv_rows = io_values->get( |{ is_field-name }-{ zif_abapgit_html_form=>c_rows }| ).
" Render table only if there are some data rows
IF lv_rows > 0.
ii_html->add( |<table name="{ is_field-name }" id="{ is_field-name }" class="table-container">| ).
ii_html->add( |<thead>| ).
@ -660,8 +665,6 @@ CLASS zcl_abapgit_html_form IMPLEMENTATION.
ii_html->add( |</tr>| ).
ii_html->add( |</thead>| ).
lv_rows = io_values->get( |{ is_field-name }-{ zif_abapgit_html_form=>c_rows }| ).
ii_html->add( |<tbody>| ).
DO lv_rows TIMES.
lv_rows = sy-index.
@ -683,6 +686,11 @@ CLASS zcl_abapgit_html_form IMPLEMENTATION.
ii_html->add( |</table>| ).
ELSE.
ii_html->add( |<input type="text" name="{ is_field-name }" id="{
is_field-name }" value="Not available" readonly>| ).
ENDIF.
" Hidden field with number of rows to simplify getting values from form
lv_value = |{ is_field-name }-{ zif_abapgit_html_form=>c_rows }|.
ii_html->add( |<input type="number" name="{ lv_value }" id="{