
The iterator is an instance object that implements interface IF_TABLEVIEW_ITERATOR. You can use the iterator to create complex logic for <htmlb:tableView> elements if, for example, you want to evaluate a table view row and calculate of the value of another row.
This iterator interface therefore makes it possible for a <htmlb:tableView> BSP element not to be rendered in one step. Instead, it allows communication with the application after each field or column, thus enabling the application to influence the rendering of a certain field, row or column.
As <htmlb:tableView> does not contain any application logic itself, the iterator allows the TableView to handle data very flexibly. The interface should be implemented by the corresponding application class of the BSP application, or - when controllers are used - by the controller class.
Interface IF_HTMLB_ITERTATOR contains three callback methods. When you execute your BSP (in which your own iterator object is embedded) with <htmlb:tableView iterator="<%= my_iterator %>" ... /> the iterator returns the three interface methods each time it encounters an <htmlb:tableView/> element or an <htmlb:tableViewColumns/> element.
method if_htmlb_tableview_iterator~render_cell_start.
* html_bee object is responsible to modify HTML code
data: html_bee type ref to cl_bsp_bee_html.
data: col_value type string.
data: html_str type string.
* <row> is a structure of table
field-symbols: <row> type any, <col> type any.
p_column_key has a name of each table column
if p_column_key = 'COLUMN_NAME'.
* conventional logic to extract column value
assign p_row_data_ref->* to <row>.
assign component p_column_key of structure <row> to <col>.
col_value = <col>.
create object html_bee.
if col_value = 'CONDITION_YOU_WANT'.
* do something interesting
html_str = "<HTML_code_you_want_to_generate_dynamically />"
endif.
* set HTML code you want...add() can have up to 10 params for concatenation
html_bee->add( html = html_str ).
p_replacement_bee = html_bee.
endif.
endmethod.
Implementing Classes |
None |
Enhanced Interface |
None |
Specializing Interfaces |
None |
-
Signature |
||
Description |
This method is called at the start of the rendering of the table view. This method contains important import parameters that provide information about the current table view. The row definitions of the table view are passed. The application can influence these definitions. You should therefore overwrite this method if you plan to make changes here. |
|
Parameter |
P_TABLEVIEW_ID | Import parameter for the ID |
| P_COLUMN_DEFINITIONS | Changing parameter for columns in the table view |
|
| P_OVERWRITES | Changing parameter to overwrite specific cells in the table view |
|
Return Values/Exceptions |
- |
|
Signature |
||
Description |
RENDER_ROW_START is called at the start of every row. This method contains important import parameters that provide useful information about the current row. Use this method if you want to influence the rendering at the start of every row. This allows you to filter rows or insert additional information for the rendering. This is especially practical for tables where not all rows are displayed. You can provide the rendering information with exactly the rows that are rendered. |
|
Parameter |
P_TABLEVIEW_ID | Import parameter for the ID |
| P_ROW_INDEX | Import parameter for the row index |
|
| P_ROW_KEY | Import parameter for the row key |
|
| P_ROW_DATA_REF | Import parameter for the reference to the data of a row |
|
| P_EDIT_MODE | Import parameter for a checkbox |
|
Return Values/Exceptions |
P_SKIP_ROW |
checkbox |
Signature |
||
Description |
RENDER_CELL_START is called at the start of each column (cell), i.e. before each individual table field is rendered. You use this method to render columns dynamically. You obtain the row and column index from the import parameters, as well as a reference to the current row. You can define a custom rendering for a specific cell. To define a new rendering engine, use parameter p_replacement_bee. Element <htmlb:tableView> then calls up this application-specific renderer for this cell. |
|
Parameter |
P_TABLEVIEW_ID |
Import parameter for the ID |
| P_CELL_ID | Import parameter for the cell ID |
|
| P_CELL_BINDING | Import parameter for the binding name |
|
| P_ROW_INDEX | Import parameter for the row index |
|
| P_ROW_KEY | Import parameter for the row key |
|
| P_COLUMN_INDEX | Import parameter for the column key |
|
| P_COLUMN_KEY | Import parameter for the column key |
|
| P_ROW_DATA_REF | Import parameter for the reference to the data of a row |
|
| P_EDIT_MODE | Import parameter for a checkbox |
|
| P_REPLACEMENT_BEE | Export parameter for a BSP extension expression (BEE) |
|
| P_STYLE | Changing parameter for <td style="...">. When using Design2003, you can change the background color of a cell with predefined colors via P_STYLE (P_CLASS is no longer analyzed in Design2003). To do this, use attribute cellDesign in P_STYLE (for example P_STYLE="cellDesign:STCD_STANDARD"). cellDesign can take the following values:
You can find an example for the use of cellDesign in the BSP application sbspext_table, page TableViewIterator.bsp class CL_SBSPEXT_ITERATOR, method IF_HTMLB_TABLEVIEW_ITERATOR~RENDER_CELL_START row 50:
if design eq '2002'.
p_style = 'background-color:#BBDDDD'.
elseif design eq '2003'.
p_style = 'celldesign:GROUP_HIGHLIGHTED_LIGHT'.
endif.
Note
Note that specifying cellDesign does not have any effect in Design2002. If you want to change the background color there, you have to use CSS attributes. On the other hand, it is no longer possible to make style settings for the cell, except using cellDesign itself. |
|
| P_CLASS | Changing parameter for <td class="...">. Note
Note that P_CLASS is no longer analyzed in Design2003. |
|
| P_ISREADONLY | Changing parameter for <td readonly>. |
|
Return Values/Exceptions |
- |
- |