I see most of the solutions in SDN is for Classical BSP page programming model and very few for MVC design pattern. Could someone please help me understand how to use iterator using MVC? This is what I did and it is giving me error - "A dynamic type conflict occurred during reference assignment."
=========================================
Code
=========================================
Implemented the interface IF_HTMLB_TABLEVIEW_ITERATOR in a class - ZPESTVI_REVWTYPE
Defined class attribute M_ROW_REF instance public type ref to zt_revw_type (table type)
Implemented the methods:
IF_HTMLB_TABLEVIEW_ITERATOR~GET_COLUMN_DEFINITIONS.
FIELD-SYMBOLS: <def> LIKE LINE OF p_column_definitions.
APPEND INITIAL LINE TO p_column_definitions ASSIGNING <def>.
<def>-COLUMNNAME = 'REVW_CODE'.
<def>-SORT = 'X'.
APPEND INITIAL LINE TO p_column_definitions ASSIGNING <def>.
<def>-COLUMNNAME = 'REVW_DESC'.
<def>-EDIT = 'X'.
<def>-SORT = 'X'.
APPEND INITIAL LINE TO p_column_definitions ASSIGNING <def>.
<def>-COLUMNNAME = 'ACTV_FLAG'.
<def>-EDIT = 'X'.
<def>-SORT = 'X'.
method: IF_HTMLB_TABLEVIEW_ITERATOR~RENDER_ROW_START.
m_row_ref ?= p_row_data_ref.
method IF_HTMLB_TABLEVIEW_ITERATOR~RENDER_CELL_START.
CASE p_column_key.
WHEN 'ACTV_FLAG'.
p_replacement_bee = CL_HTMLB_CHECKBOX=>FACTORY
( id = p_cell_id
checked = 'm_row_ref->ACTV_FLAG' ).
ENDCASE.
====================================================
In my controller:
DO_REQUEST
create the iterator
create object c_iterator type ZPESTVI_REVWTYPE.
create view instance
v_revwtype = create_view( view_name = 'zrevwtype.htm').
v_revwtype->set_attribute( name = 'v_tviterator' value = c_iterator ).
where c_iterator is defined as controller attribute instance public type ref to IF_HTMLB_TABLEVIEW_ITERATOR.
===================================================
In my view:
<htmlb:form id="MyForm">
<htmlb:tableView id = "tv1"
visibleRowCount = "15"
selectionMode = "LINEEDIT"
table = "//vmodelsetup/m_revwtype"
iterator = "<%= v_tviterator %>" />
</htmlb:form>
where v_tviterator is defined as page attribute type ref to IF_HTMLB_TABLEVIEW_ITERATOR.
========================================================
First of all it doesn't work. Secondly, how do I display the checkbox with data binding?
Please help.
Thanks,
Partho