I have a requirement where we need to show data in sap.m.Table where columns are Question and Ans.
For objective type question the Ans column should have a sap.m.switch instead of a free text.
I am able to do up to this.
However I am having issue in binding the state of the sap.m.switch control.
My table definition is:
<Table id="idQATable1"
inset="false"
items="{
path: '/QA',
sorter: {
path: 'QuestionType'}
/>
<headerToolbar>...</headerToolbar>
<columns>
<Column1.../>
<Column2.../>
</Columns>
<items>
<ColumnListItem >
<cells>
<Text text="{Question}" />
<Switch state="{Ans==true}" customTextOn="Yes" customTextOff="No"/>
</cells>
</ColumnListItem>
</items>
</Table>
The issue is the data type on the table for "Ans" is String but Switch state is a boolean value. I tried with putting condition check directly in the binding
state="{Ans==true}". But this is always returning false. so the switch is showing in false state always.
Please help on how to put such conditions within table column?
Thanks
Shibaji