HI,
I'm a SAPUI5 beginner, having a problem with if-else statement in XML view.
I'm trying to create a table in XML view. Values in table are binded from .json file (in the future, values will be binded via oData service). Below is the code.
<mvc:View
controllerName="demo.prototype.controller.TestController"
xmlns:t="sap.ui.table"
xmlns:mvc="sap.ui.core.mvc"
xmlns:u="sap.ui.unified"
xmlns:c="sap.ui.core"
xmlns="sap.m"
xmlns:template="http://schemas.sap.com/sapui5/extension/sap.ui.core.template/1">
<t:Table
rows="{/ProductCollection}"
visibleRowCount="7"
selectionMode="MultiToggle"
width="75rem">
<t:columns>
<t:Column width="10rem">
<Label text="{i18n>modelGroup}" />
<t:template>
<Label text="{modelGroup}" />
</t:template>
</t:Column>
<t:Column width="4rem">
<Label text="{i18n>line}" />
<t:template>
<Label text="{line}"/>
</t:template>
</t:Column>
<t:Column width="6rem">
<Label text="{i18n>date}" />
<t:template>
<Input value="{data1}"
description="/100" />
</t:template>
</t:Column>
</t:columns>
</t:Table>
</mvc:View>
I want to switch Control(Input or Label) or to switch "display description or not" in Input control, depending on flg (true or false) in .json file. But I cannot find the way to do that. I found "http://schemas.sap.com/sapui5/extension/sap.ui.core.template/1" in other questions and tried, but it did not work.
There are 2 ways probably・Implement in Controller ・Implement in XML view.
The 2nd way is preferable for me.
Could anyone help me?
If there is missing information, please point them out.
Thank you for your support.
Request clarification before answering.
you cannot use view with template directly. you have to pre-process the template.
use the easy way : a flag to control the visibility
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.