cancel
Showing results for 
Search instead for 
Did you mean: 

Input handling of edited cells (with an iterator)

Former Member
0 Kudos

Hi, I have a Tableview with some inputfields and dropdownfields on some cells. The user changes the contents of this cells and the press a button to save this changes on the internal table associated with the table view.

The problem that I have is that I dont know how to loop on the table view to take this inputfields and save the information on the internal table... Is there any sample? Do I have to capture some event and save the information as soon as the user enters the information on the field?

Thanks for helping

Ariel

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Have you checked out these weblogs?

/people/thomas.jung3/blog/2004/09/15/bsp-150-a-developer146s-journal-part-xi--table-view-iterators

/people/brian.mckellar/blog/2003/10/31/bsp-programming-htmlb-tableview-iterator

Each tablecell has an id "tableid" + "_" + row + "_" + cell or is it "tableid" + "_" + cell + "_" + row so you can then read the value stored at that ID if just like with a single element on the page.

Former Member
0 Kudos

Yes, I have read this blogs, the problem is that this one blog written by Thomas is about how to capture the combo box information from an event. Then the Blog written by Brian McKellar tells in the last paragraph

"... Input handling of edited cells has not been discussed. This is left as a topic for another article. (First we must ask Steffen, the real expert behind the tableView, for the answers.)...."

What I what to do is to query the inputfields and combo boxes that are into the table columns but "<b>without</b>" events.

This is what I want to do, and what I dont know how to do

Thanks

Ariel

Message was edited by: Ariel Ferreiro

Message was edited by: Ariel Ferreiro

Message was edited by: Ariel Ferreiro

Former Member
0 Kudos

Without events? May I ask why?

I implemented Brain's code for the Flights Iterator then using normal JavaScript I did the following on my page as a test.


<%@page language="abap" %>
<%@extension name="htmlb" prefix="htmlb" %>
<htmlb:content design="design2002" >
  <htmlb:page>
    <htmlb:form>
      <htmlb:tableView id              = "tv1"
                       visibleRowCount = "10"
                       selectionMode   = "lineEdit"
                       table           = "<%= flights %>"
                       iterator        = "<%= iterator %>" />
      <br><br>
      <a href="javascript:alert(document.getElementById('tv1_1_8_first').value)">Read row 1 seat 1</a>
    </htmlb:form>
  </htmlb:page>
</htmlb:content>

The iterator for the Seats field was defined as


WHEN 'SEATS'.
      IF p_edit_mode IS INITIAL.

        DATA: max TYPE STRING, occ TYPE STRING, value TYPE STRING.
        max = m_row_ref->SEATSMAX + m_row_ref->SEATSMAX_B + m_row_ref->SEATSMAX_F.
        occ = m_row_ref->SEATSOCC + m_row_ref->SEATSOCC_B + m_row_ref->SEATSOCC_F.
        CONDENSE: max, occ.
        CONCATENATE occ ` / ` max INTO value.
        p_replacement_bee = CL_HTMLB_TEXTVIEW=>FACTORY( text = value ).

      ELSE.

        DATA: if_first TYPE REF TO CL_HTMLB_INPUTFIELD.
        if_first = CL_HTMLB_INPUTFIELD=>FACTORY( id = p_cell_id id_postfix = '_first'
                                                 type = 'INTEGER' size = '4' ).
        if_first->VALUE = m_row_ref->SEATSOCC_F.

        DATA: if_bus   TYPE REF TO CL_HTMLB_INPUTFIELD.
        if_bus   = CL_HTMLB_INPUTFIELD=>FACTORY( id = p_cell_id id_postfix = '_bus'
                                                 type = 'INTEGER' size = '4' ).
        if_bus->VALUE = m_row_ref->SEATSOCC_B.

        DATA: if_econ  TYPE REF TO CL_HTMLB_INPUTFIELD.
        if_econ = CL_HTMLB_INPUTFIELD=>FACTORY( id = p_cell_id id_postfix = '_econ'
                                                 type = 'INTEGER' size = '4' ).
        if_econ->VALUE = m_row_ref->SEATSOCC.

        DATA: seats_bee TYPE REF TO CL_BSP_BEE_TABLE.
        CREATE OBJECT seats_bee.
        seats_bee->ADD( if_first ).
        seats_bee->ADD( if_bus ).
        seats_bee->ADD( if_econ ).

        p_replacement_bee = seats_bee.
      ENDIF.

As you can see the first seat id was defined with

<b><i>id = p_cell_id id_postfix = '_first'</i></b>

It works the same way when reading it with Event Handlers. You can even then just read the GET_FORM_DATA for that ID

format: tablename _ row _ cell

Former Member
0 Kudos

Thanks Craig, right now I am feeling a little bit stupid, The solution is very simple, maybe what I was trying to found is some "magical" method on the tableview class or something like this.. I ll have to work a little to update my table..

Thank again,

Ariel

Former Member
0 Kudos

I know the feeling, I had the same problem in the beginning when working with the tableView in edit mode.

Glad I could help, if this all answered your message remember to mark it solved so others can find the solutions faster in the future

Answers (0)