cancel
Showing results for 
Search instead for 
Did you mean: 

How solve problem with Binding?

Former Member
0 Kudos

Hi

I have many problems with binding!

I have InputField1 (type string) bindet to VAR1 (from Context -> Node -> Attribute)

I have TextView1 bindet to VAR1

When I write to InputField1 (bindet to VAR1) and press Enter TextView1 (bindet to VAR1) is not changed

When I have InputFiled2 (type D) bindet to VAR2 (from Context -> Node -> Attribute)

And TextView2 bindet to VAR2 (from Context -> Node -> Attribute)

When I select value through search help in InputFiled2 value in TextView2 is not changed!

Where is a problem?

Thank you

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Problem is in the binding ONE attribute to more object.

When I have InputField1 (type string) bindet to VAR1

and TextView2 bindet to VAR2

and in InputField I have event "onEnter" and this method i read VAR1 and set to VAR2 everything is OK

Problem is only case when I have more objects (InputField1, TextView1, TextView2 etc.) bindet to ONE attribute!

But when I set this ONE attribute in WDDINIT (set VAR1 = 'text') in ALL objects (InputField1, TextView1, TextView2 etc.) bindet to VAR1  show same value = 'text'

Why is problem ONLY in binding more objexts to same ONE attribute?

When I bing more objects to more attribute everything is OK.

former_member184578
Active Contributor
0 Kudos

Hi,

Problem is only case when I have more objects (InputField1, TextView1, TextView2 etc.) bindet to ONE attribute!

It's not the case. You can bind the same attribute to Inp and Text UIs, but you need to press Enter after entering data in Input(with onEnter event created). Then the screen renders and you can see the value in both the UI elemnts.

Regards,

Kiran

former_member197475
Active Contributor
0 Kudos

Hi,

This is the standard functionality of the UI elements and it's binding concepts.

For eg, If you bind the same attribute(String = TEST) to all of your UI elements, then in the final output you will only get 'TEST' for all the UI elements.

Check for the below help doc on Data Binding.

https://help.sap.com/saphelp_nw04s/helpdata/en/af/434941db42f423e10000000a155106/content.htm

BR,

RAM.

Former Member
0 Kudos

Hi

But how code I must give to onEnter event?

I have context attribute var1 (type string) with initial value 'init'

I have 2 UI element InputFiel1 and TextView1 bindet to same context attribute var1.

When I start program, in both UI element i see 'init' - this OK

Then I insert value to UI InputField1 'test' and press Enter -> var1 = 'test', but I see only in InputField1 not in TextView1

in this moment i see

InputField1 -> 'test'

TextView1 -> 'init'

How code I must put to onEnter event?

read var1 and then set var1???

Thank

former_member184578
Active Contributor
0 Kudos

Hi,

You don't have to read and set the value back to text view, Just create an Action for onEnter of Input field and when you change data and press Enter in the input field you can see the changed value in text view too.

Regards,

Kiran

ramakrishnappa
Active Contributor
0 Kudos

Hi,

You no need to do any coding inside the event handler OnEnter, as both input field and text view bound to same attribute, it automatically reflects on next view rendering. Here you just asking framework to re-render the view using action.

Regards,

Rama

Former Member
0 Kudos

Hi Kiran Kumar Valluru

Thank you.

It was necessary created blank event.

Answers (3)

Answers (3)

former_member184578
Active Contributor
0 Kudos

Hi,

Data from UI to Context Node or vice versa will be transferred upon the screen rendering. Create an onEnter event for your input filed( can be empty).

then when you press enter, your screen will render and the data will transfer from Input to context node and from Context to Text View and you can see the Text.

hope this helps,

Regards,

Kiran

ramakrishnappa
Active Contributor
0 Kudos

Hi,

You should have an action created for INPUT FIELD1, field2.

So that on an action , the framework update the context and re-renders the view ( Refreshes the view the latest data ) . Hence your value of input field reflects in TEXT view.

Create an action attach to the input fields, it solves your issue.

Hope this helps you.

Regards,

Rama

former_member197475
Active Contributor
0 Kudos

Hi,

Input Field and Text View behaviours are entirely different. Though you have binded both of them to a single attribute, you can't expect the change in your Text View on any action over your Input Field.

It can be done by dynamically on handling the onEnter event action of your Input Field.

Please explain your requirement, such that it makes easier to get with it.

BR,

RAM.