on 12-03-2004 4:04 PM
Hi,
I looked at the example BSP_MODEL and now I am trying to build a simple test application with a tableview.
I can easily display data from my model in the tableview, but I can't get the modified data back to my model.
I have implemented the method DO_HANDLE_DATA in the table's controller with the following code:<i>
CALL METHOD super->do_handle_data
EXPORTING
form_fields = form_fields
global_messages = global_messages.</i>
The DO_INIT method is like this:
<i>m_model ?= create_model( model_id = 'm'
class_name = 'ZNP5' ).
if m_model is bound.
m_model->init( ). "a simple select on SFLIGHT
endif.</i>
Obviously I missed something, any idea?
Thanks for your help.
Nicolas
Are you working stateless?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Nicolas,
It is not advicable to use Server side cookies to store huge amount of data. Actually you have an option 'Stateful from now on' in BSP. This option is neither totally stateful or stateless. Whenever there is data exchange it is useful to set this property of the main page or controller from which the program starts.
Unless it is required,server side cookies should be used to store huge data.
Regards,
Vara
Hi Nicolas,
Is your table defined as an attribute in your m_model class? Can you post your HTMLB tableview statement? And your select statement? You probably have a typo that needs another set of eyes to find. Happens to me all the time
Cheers,
Rich
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Richard,
Here are more details on my test application:
Model:
- Class Name: ZNP5, superclass: CL_BSP_MODEL
- Attributes: FLIGHTS, Public, TYPE FLIGHTTAB
- Method INIT, Public:
SELECT * FROM sflight INTO TABLE flights.
The BSP Applications consists of a main controller (main.do) and a subcontroller (table.do) calling views main.htm and table.htm.
MAIN.DO:
- DO_INIT method
DATA: subc1 TYPE REF TO cl_bsp_controller2.
subc1 ?= create_controller( controller_name = 'table.do'
controller_id = 'subc1' ).
- DO_REQUEST method
DATA: view TYPE REF TO if_bsp_page.
dispatch_input( ).
view ?= create_view( view_name = 'main.htm' ).
call_view( view ).
TABLE .DO
- Attributes: M_MODEL, Private, Type Ref To ZNP5
- DO_INIT method
m_model ?= create_model( model_id = 'm'
class_name = 'ZNP5' ).
if m_model is bound.
m_model->init( ).
Endif.
- DO_REQUEST method
DATA: view TYPE REF TO if_bsp_page.
view ?= create_view( view_name = 'table.htm' ).
view->set_attribute( name = 'model' value = m_model ).
call_view( view ).
- DO_HANDLE_DATA method
CALL METHOD super->do_handle_data
EXPORTING
form_fields = form_fields
global_messages = global_messages.
main.htm
<%@page language="abap" %>
<%@extension name="htmlb" prefix="htmlb" %>
<%@extension name="xhtmlb" prefix="xhtmlb" %>
<%@extension name="bsp" prefix="bsp" %>
<htmlb:content design="design2003" >
<htmlb:page title=" " >
<htmlb:form>
<bsp:call comp_id="subc1" />
</htmlb:form>
</htmlb:page>
</htmlb:content>
table.htm
Attributes: model Type ref to ZNP5
SelectedRow type string
<%@page language="abap" %>
<%@extension name="htmlb" prefix="htmlb" %>
<htmlb:tableView id = "tvX"
headerText = "Connections"
width = "100"
headerVisible = "true"
design = "alternating"
visibleRowCount = "8"
fillUpEmptyRows = "true"
showNoMatchText = "true"
filter = "server"
sort = "server"
onHeaderClick = "MyEventHeaderClick"
onRowSelection = "MyEventRowSelection"
selectionMode = "LINEEDIT"
selectedRowIndex = "<%= selectedRow %>"
table = "//model/flights"
tabIndexCell = "true" />
I've just discovered that the data is actually transfered to the model but it's not retained: When I edit the 1st line of the table, the modified values are transfered to the model, but if I edit the 2nd line, I loose the previous changes... How to solve this?
Regards,
Nicolas
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.