cancel
Showing results for 
Search instead for 
Did you mean: 

BSP - TableView overwritten by input fields in same page

Former Member
0 Kudos
36

Hi everybody!

We try to implement a page with a tableview, loading datas in the onCreate with a CallFunction, and then looping on itself to modify the datas before saving in a cookie:

OnCreate

OnInitialize <--

Layout |

Processing -

-


The tableView is displaying a table "T".

There is an input field "F" in the table.

We have a "reset to 0" button in the page affecting the field F of table T.

The reset is done in OnInputProcessing.

Problem : when reseting, the TableView displays the input field value, and not 0. Yet, when debugging, I can see that T contains 0, in the Layout execution.

So I guess the page input fields are overwritting the table of the tableView.

Thanks a lot in advance, best regards

François

Accepted Solutions (0)

Answers (1)

Answers (1)

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

Welcome.

Perhaps it would help to share a small bit of the code where you render the input field for the table. Is it done via an iterator?

Former Member
0 Kudos

Thanks a lot for your reply

This is what happens more in details:

In my page, I have a table with a modifiable column, that maybe I want to reset:

Let's suppose I have typed "1" in many rows, but aftewards, I want to reset to 0.

Layout:

...

<htmlb:groupBody>

<%-- TableView with columns description table --%>

<htmlb:tableView id = "tvX"

table = "<%= requisition %>"

design = "ALTERNATING"

headerVisible = "TRUE"

keepSelectedRow = "TRUE"

visibleRowCount = "15"

fillUpEmptyRows = "true"

onHeaderClick = "MyEventHeaderClick"

onRowSelection = "MyEventRowSelection"

selectionMode = "LINEEDIT"

width = "100%"

iterator = "<%= tv_iterator %>" >

<htmlb:tableViewColumns>

<htmlb:tableViewColumn columnName = "BANFN"

title = "N° Demande d'achat"

sort = "true" >

</htmlb:tableViewColumn>

<htmlb:tableViewColumn columnName = "MENGE_VAL"

title = "Quantité modifiée"

type = "INPUT" >

..

<htmlb:button id = "init"

text = "Init"

onClick = "onInputProcessing(init)" />

...

OnInputProcessing :

Nothing (so when clicking on "Init", we come back on the same page into OnInitialization)

...

OnInitialization:

loop at requisition into wa_requisition.

wa_requisition-menge_val = 0.

modify requisition from wa_requisition.

endloop.

The page still displays the "1" whereas I see "0" in debug in the Layout.

I suppose the tableView is displayed not only from the table "requisition" but from a table corresponding to the inputs in page, which is initialized in the OnCreate part, but not in the On Initialization.

The iterator is the standard one.

Do you have an idea?

Best regards

Former Member
0 Kudos

hi,

The answer to your problem lies in wether your application is statefull or not since in case of statefull application only the oncreate is called once else it is called at all requests to the server.

You can achieve the same by declaring a variable say "set" and initialize it as set = '0' on oncreate event. and whenever user clikcs on init(button) write in its event handler in oninputprocessing as set = '1'.

also make a little change in you pagelayout.

prior to display od tableview write

<%

if set eq '1'.

loop at requisition into wa_requisition.

wa_requisition-menge_val = 0.

modify requisition from wa_requisition.

endloop.

endif.

%>

if you want to reflect the resetting of field to '0' in your table also. Then you have to run update querry in oninputprocessing of the click of the button as:

update TABLENAME set FIELD = '0'.

and then you need not have to write the above code in your layout also.

hope this will help you. reply if not.

regards,

Hemendra

Former Member
0 Kudos

Hi!

Thanks for your answer; in the meantime, I found a topic dealing with the same problem and providing a working solution :

Francois