
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 TableView 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 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.
In transaction SE24, you can create your own class that implements the interface IF_HTMLB_TABLEVIEW_ITERATOR.
Instantiate your iterator class.
Note that you execute the instantiation via the application class or the controller class.
Embed your iterator instance in the <htmlb:tableView iterator=<%= my_iterator %> ... /> element.
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 method render_cell_start:
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.
See also:
Inheritance Hierarchy/Interface Composition
Implementing Classes
-
Enhanced Interface
-
Specialized Interfaces
-
Attributes
-
Methods
Method get_column_definitions
|
Signature |
||
|
Description |
This method is called when rendering of the TableViews is started. This method contains important import parameters that provide information about the current TableView. The row definitions of the TableViews are specified. The application can make a difference here. You should therefore overwrite this method 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 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. |
|
|
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 start of each column (cell), i.e., before each individual table field is rendered. 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. You can define a custom rendering for a specifiic 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. |
|
|
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 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 |
- |