!--a11y-->
Iterator: Interface IF_HTMLB_TABLEVIEW_ITERATOR 
The iterator is an instance object that implements the interface IF_TABLEVIEW_ITERATOR. With the iterator, you can create complex logic for <htmlb:tableView> elements, for example for the evaluation of a TableView row and calculation of the value of another row.
This iterator interface makes it possible that a <htmlb:tableView> BSP element is not rendered in one step, but that there is a communication with the application after each field or column which enables the application to influence the rendering of a certain field, row or column.
As <htmlb:tableView> does not contain 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.
The interface IF_HTMLB_ITERTATORcontains 3 callback methods.
When processing its BSP (in which its own iterator object is embedded) with <htmlb:tableView iterator="<%= my_iterator %>" ... />, the iterator calls back the three interface methods every time it encounters an <htmlb:tableView/> element or an <htmlb:tableViewColumns/> element.
...
1. In transaction SE24, you can create your own class that implements the interface IF_HTMLB_TABLEVIEW_ITERATOR.
2. Instantiate your iterator class.
Note that you execute the instantiation via the application class or the controller class.
3. Embed your iterator instance in the <htmlb:tableView iterator=<%= my_iterator %> ... /> element.
4. The three methods of IF_HTMLB_TABLEVIEW_ITERATOR are called, i.e., called back. You can implement them according to your needs.

Minimal example coding for the implementation of the method render_cell_start:
method if_htmlb_tableview_iterator~render_cell_start. * html_bee object is responsible to modify HTML code * <row> is a structure of table field-symbols: <row> type any, <col> type any. * p_column_key has a name of each table column * conventional logic to extract column value * do something interesting html_str = "<HTML_code_you_want_to_generate_dynamically />" * set HTML code you want...add() can have up to 10 params for
concatenation endif. endmethod. |
See also:
How do I get a blank line using the iterator?
-
-
-
-
Method get_column_definitions
Signature |
|
|
Description |
This method is called at the start of the rendering of the TableViews. This methode contains important import parameters which provide information about the current TableView. The row definitions of the TableViews are handed over. At this moment, the application can exert influence. Overwrite this methode, if you plan to make changes here. |
|
Parameters |
P_TABLEVIEW_ID |
Import parameter for the ID |
P_COLUMN_DEFINITIONS |
Changing parameter for columns in the TableView |
|
P_OVERWRITES |
Changing parameter to overwrite certain cells in the TableView |
|
Return values / Exceptions |
- |
|
Method render_row_start
Signature |
|
|
Description |
RENDER_ROW_START is called at the beginning of every row. This methode contains important import parameters which provide useful information about the current row. Use this method if you want to influence the rendering at the beginning of every row. You can filter rows or insert additional information to the rendering. This is especially convenient for tables that do not put out all rows. You can give the rendering information exactly to the rows that are rendered. |
|
Parameters |
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 |
Method render_cell_start
Signature |
|
|
Description |
RENDER_CELL_START is called at the beginning of every column (cell), i.e., before the rendering of every single table field. You use this method to render columns dynamically. Via the import parameters, you obtain the row and column index, as well as a reference to the current row. Thus, you can define a custom rendering for a certain row as is shown in: Custom-Rendering for the Author column. To define a new rendering engine, use the parameter p_replacement_bee. Then, the <htmlb:tableView> element calls this application-specific renderer for this row. |
|
Parameters |
P_TABLEVIEW_ID |
Import parameter for the ID |
P_CELL_ID |
Import parameter for the cell ID |
|
P_CELL_BINDING |
Importparameter 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 index |
|
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 the attribute cellDesign in P_STYLE (e.g. P_STYLE="cellDesign:STCD_STANDARD"). Possible values of
cellDesign are STCD_STANDARD, STCD_ALTERNATING, STCD_TRANSPARENT, STCD_NEGATIVE, You can find an example for the use of cellDesign in the BSP application sbspext_table, page TableViewIterator.bsp, iterator 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, that the specification of cellDesign does not have any effect in Design2002. If you want to change the background color there, you have to do this via CSS attributes. On the other hand, it is no longer possible to set specifications in Design2003 style for the cell, except via cellDesign itself. |
|
P_CLASS |
Changing parameter for <td class="...">.
Note, that P_CLASS is no longer anaylzed in Design2003. |
|
P_ISREADONLY |
Changing parameter for <td readonly>. |
|
Return values / Exceptions |
- |
|
You find an example in the BSP tutorial: Our Little Online Bookshop using MVC and HTMLB and Custom-Rendering for the Author column.