1

Trying to get right syntax for context binding in XML view. I have a JSON model and set the model to view with name "company" inside controller. When I use absolute path, it works but when I use relative path, it doesn't. It seems, view is unable to access the model in second case.

My Code

<Text text ="{company>/data/name}" width="200px"/>
<Input binding="{company>/data}" value ="{name}" width="200px"/>

1 Answer 1

1

When binding a property, you also have to provide the name of the model. Otherwise the "nameless" default model is assumed. But since all your data is in the company model you have to explicitly state that name for your value.

<Input binding="{company>/data}" value="{company>name}" width="200px"/>
Sign up to request clarification or add additional context in comments.

3 Comments

that works! Thank you very much. My expectation was, I do not need to mention the model name again , because I already did that in "binding".
@SQL_NOVICE Glad to hear it worked :) Please accept this answer to let others know that this issue is resolved now.
@SQL_NOVICE the beauty of it is that you can use multiple models this way. For example you can do value="{i18n>label.companyName} {company>name}" and combine a translated value of your i18n file with the value of your json model. The binding just makes it easier to access a specific entry of your model.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.