TableView get_cell_value

BusinessServerPages; Erstellung von Webapplikationen.

TableView get_cell_value

Postby Joel5259 » Fri Oct 19, 2007 8:58 am

Hallo,

ich lasse meine Daten in einer TableView anzeigen. Wählt der Benutzer eine Zeile aus, so will ich den Wert dieser Zeile aus der ersten Spalte auslesen.

im Layout - Teil:
Code: [Select all] [Expand/Collapse] [Download] (Untitled.txt)
  1. ...
  2. <htmlb:form>
  3.  
  4.  <htmlb:tableView    id                   = "tv1"
  5.                           headerText           = "Suche nach <%= p_suche %>"
  6.                           headerVisible        = "true"
  7.                           footerVisible        = "true"
  8.                           design               = "ALTERNATING"
  9.                           table                = "<%=my_suche%>"
  10.                           selectionMode        = "SINGLESELECT"
  11.                           visibleRowCount      = "20"
  12.                           onRowSelection       = "onMyRowSelection">
  13.  </htmlb:tableView>
  14. </htmlb:form>
GeSHi ©


im Eventhanlder:
Code: [Select all] [Expand/Collapse] [Download] (Untitled.txt)
  1. CLASS CL_HTMLB_MANAGER DEFINITION LOAD.
  2.  
  3. IF event_id = CL_HTMLB_MANAGER=>EVENT_ID.
  4.  
  5.   DATA: event TYPE REF TO CL_HTMLB_EVENT,
  6.              fval type string.
  7.  
  8.   event = CL_HTMLB_MANAGER=>get_event&#40; runtime->server->request &#41;.
  9.  
  10.  IF event->name = 'tableView'.
  11.  
  12. *  Declarations
  13.     DATA: tableview_event TYPE REF TO CL_HTMLB_EVENT_TABLEVIEW,
  14.           selected_row_index TYPE selectedrow-index,
  15.           tv TYPE REF TO cl_htmlb_tableview.
  16.  
  17.     tv ?= cl_htmlb_manager=>get_data&#40; request = request
  18.                                         name    = 'tableView'
  19.                                         id      = 'tv1' &#41;.
  20.  
  21.  IF tv IS NOT INITIAL.
  22.     tableview_event = tv->data.
  23.  
  24. *    selected_row_index = tableview_event->selectedrowindex.
  25. selected_row_index = tableview_event->prevselectedrowindex.
  26.  
  27. CALL METHOD TABLEVIEW_EVENT->GET_CELL_VALUE
  28.   EXPORTING
  29.     ROW_INDEX    = selected_row_index
  30.     COLUMN_INDEX = 1
  31.   RECEIVING
  32.     VALUE        = fval
  33.     .
  34.  
  35.     ENDIF.
  36.  
  37.   ENDIF.
GeSHi ©


Aus mir unerklärlichen Gründen funktioniert die Methode GET_CELL_VALUE nicht; mein fval ist immer leer.

Kann mir da jemand helfen ???

Danke im Voraus.
Joel5259
.
.
 
Posts: 7
Joined: Wed Oct 17, 2007 2:15 pm

Postby Klaus2318 » Wed Nov 28, 2007 3:31 pm

Also ich mache das so:

Layout:
Code: [Select all] [Expand/Collapse] [Download] (Untitled.txt)
  1.       <htmlb:tableView id               = "tv1"
  2.                        headerText       = "IT-Controlling lookup data"
  3.                        headerVisible    = "true"
  4.                        design           = "alternating"
  5.                        visibleRowCount  = "8"
  6.                        fillUpEmptyRows  = "true"
  7.                        selectionMode    = "LINEEDIT"
  8.                        table            = "<%= gt_flights %>"
  9.                        iterator         = "<%= cls_iterator %>"
  10.                        filter           = "SERVER"
  11.                        selectedRowIndex = "<%= g_selected_index %>"
  12.                        visibleFirstRow  = "<%= g_first_vis_row %>"
  13.                        />
  14.  
GeSHi ©



OnInputProcessing
Code: [Select all] [Expand/Collapse] [Download] (Untitled.txt)
  1. IF tv IS NOT INITIAL.
  2.  
  3. * select another row of tableview
  4.   table_event = tv->data.
  5.  
  6.   IF NOT table_event->ROW_INDEX IS INITIAL.
  7.     g_selected_index = table_event->ROW_INDEX.
  8.   ENDIF.
  9.  
  10.  
  11. * write data of prior row
  12.   IF NOT table_event->PREVSELECTEDROWINDEX IS INITIAL.
  13.  
  14.     READ TABLE gt_flights INDEX table_event->PREVSELECTEDROWINDEX ASSIGNING
  15.               <fs_row>.
  16.  
  17. *   for each field
  18.     DO.
  19. *     |
  20. *     |
  21.       ASSIGN COMPONENT sy-index OF STRUCTURE <fs_row> TO <fs_field>.
  22.       IF sy-subrc <> 0.
  23.         EXIT.
  24.       ENDIF.
  25.  
  26.       l_value = table_event->GET_CELL_ID&#40; row_index    =  table_event->PREVSELECTEDROWINDEX
  27.                                         column_index = sy-index &#41;.
  28.  
  29.       inputfield ?= CL_HTMLB_MANAGER=>GET_DATA&#40; request = request
  30.                                                 name    = 'inputField'
  31.                                                 id      = l_value &#41;.
  32.  
  33.       l_value  = table_event->get_cell_value&#40; row_index    =  table_event->PREVSELECTEDROWINDEX
  34.                                             column_index = sy-index &#41;.
  35.  
  36.       l_value = inputfield->value.
  37.  
  38.       TRY.
  39.         <fs_field> = l_value.
  40.       CATCH cx_sy_conversion_no_number.
  41. *       any better ideas?
  42.         REPLACE ALL OCCURRENCES OF '.' IN l_value WITH ''.
  43.         REPLACE ALL OCCURRENCES OF ',' IN l_value WITH '.'.
  44.         <fs_field> = l_value.
  45.       ENDTRY.
  46. *     |
  47. *     |
  48.     ENDDO.
  49.     IF g_selected_index = table_event->PREVSELECTEDROWINDEX.
  50.       CLEAR: g_selected_index.
  51.     ENDIF.
  52.  
  53.   ENDIF.
  54.  
GeSHi ©


An der Stelle ...
Code: [Select all] [Expand/Collapse] [Download] (Untitled.txt)
  1.   <fs_field> = l_value.
GeSHi ©

steht in l_value der Feldwert.
Klaus2318
.
.
 
Posts: 2
Joined: Wed Nov 28, 2007 3:31 pm


Return to BSP + BHTML

Who is online

Users browsing this forum: No registered users and 1 guest