cancel
Showing results for 
Search instead for 
Did you mean: 

Data Binding with tableview

Former Member
0 Kudos

Hi,

I'd like to know how to have data binding set up for a table view.

Inside my htm file:

<htmlb:tableView id       = "tbv_CostTrip"
                     table    = "//model/AT_IUI_COSTASSIGNTRIP"
                     selectionMode = "SINGLESELECT"
                         keyColumn = "ORDER"
                     selectedRowIndex = "0"
                     footerVisible = "false"
                     iterator = "<%= ATO_ITERATOR %>"

Inside my IF_HTMLB_TABLEVIEW_ITERATOR~RENDER_CELL_START


case P_COLUMN_INDEX.


    when AT_SV_DIST.
      CONCATENATE 'PERC_SHARE' l_rownum INTO l_id SEPARATED BY '-'.
      create object lo_inputfield.
      lo_inputfield->id = l_id.
      lo_inputfield->disabled = l_disable.
      IF l_disable = 'TRUE'.
        lo_inputfield->value = <FS_ROW>-PERC_SHARE.
      ELSEIF l_disable = 'FALSE'.
        lo_inputfield->value =
'//model/AT_IUW_COSTASSIGNTRIP/PERC_SHARE'..
      ENDIF.
      P_REPLACEMENT_BEE = lo_inputfield.

The user is able to add lines to the tableview for input (only one line at a time). My idea was to bind the fields of this new line to a workarea if l_disable = 'FALSE'.

To save I would append this workarea to //model/AT_IUI_COSTASSIGNTRIP somewhere else.

To add a new line for input I simply insert an initial line into internal table //model/AT_IUI_COSTASSIGNTRIP.

<b>I think there's someting wrong with my design.. but...

When I move from page to page, the number of lines I added are persistent, but the data I input into the input boxes are lost. This happened even before I attempted the workarea method.

Overall I'm just confused here, is there a way to do this without using a workarea?</b>

Message was edited by: Kevin Wong

Message was edited by: Kevin Wong

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Thinking you have a stateful MVC App. the following should help in iterator:

when 'YOUR_COL'.

if p_edit_mode is not initial.

p_replacement_bee ?= cl_htmlb_inputfield=>factory(

id = p_cell_id

value = pcell_binding

cellvalue = 'TRUE' ).

else.

p_replacement_bee ?= cl_htmlb_inputfield=>factory(

id = p_cell_id

value = pcell_binding

cellvalue = 'TRUE'

disabled = 'TRUE' ).

endif.

Former Member
0 Kudos

hi,

you can use internal table to show data in tableview.

lets say you have a structure struct1, and a table type or table of type struct1.

now in your iterator use this structure(struct1) inside attributes do m_row_ref type ref to struct1.

in your htm file define a itab(internal table) of type struct1(using table type of struct1).

now when ever you get an event to fill data in the event catcher(oninputprocessing or do_handle_event(if mvc)) fill up the internal table(itab).

this way you will get the data filled up in table view and the data will not be lost in server round trip.

<b>When I move from page to page</b>

if you are moving from one page to another then page instance get lost and so the attributes value too. so for that either you pass filled up data too pages traversed and receive them again when opening the same page, or store them in some transparent table or else.

do revert back if problem remains.

regards