Skip to Content
0

how to bind data to sap.m.table..please give one example

Dec 15, 2016 at 11:42 AM

224

avatar image

sap.m.table data binding example

10 |10000 characters needed characters left characters exceeded

here is the sdk example

https://sapui5.hana.ondemand.com/explored.html#/sample/sap.ui.table.sample.Basic/code

you can also find more controls and their XML code
0
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Radek Chudziak Dec 15, 2016 at 12:05 PM
0
<Table id="idProductsTable"         
items="{ path: '/ProductCollection'}">
        <columns>
            <Column>
                <Text text="Supplier" />
            </Column>          
        </columns>
        <items>
            <ColumnListItem>
                <cells>
                    <Text
                        text="{SupplierName}" />
                </cells>
            </ColumnListItem>
        </items>
    </Table>
Share
10 |10000 characters needed characters left characters exceeded
Vijay Kumar Kalluri Dec 15, 2016 at 02:06 PM
0

In Controller

onInit: function() {
var ojsonModel = new sap.ui.model.json.JSONModel("model/tableData.json");
sap.ui.getCore().setModel(ojsonModel,"ojsonModel");
}

in View

<Table rows="{ojsonModel>/tableDetails}" title="Display Data into the Table using JSON Model"
selectionMode="MultiToggle" visibleRowCount="4" enableGrouping="true" threshold="2">
<columns>
<Column width="5rem">
<m:Label text="Emp Id" />
<template>
<m:Text text="{ojsonModel>assID}" />
</template>
</Column>
<Column width="4rem">
<m:Label text="Emp Name" />
<template>
<m:Input value="{ojsonModel>Name}" />
</template>
</Column>
<Column width="5rem">
<m:Label text="company Name" />
<template>
<m:Text text="{ojsonModel>companyName}" />
</template>
</Column>
</columns>
</Table>

JSON Model:

{
"tableDetails": [{
"assID": "482004",
"Name": "Vijay Kalluri",
"Age": "30",
"companyName": "Cognizant Technology Solutions",
"salaryInfo": "1000"
}, {
"assID": "482005",
"Name": "Venkata Ram",
"Age": "30",
"companyName": "Cognizant Technology Solutions",
"salaryInfo": "1000"
}, {
"assID": "482006",
"Name": "Jyothia",
"Age": "30",
"companyName": "Cognizant Technology Solutions",
"salaryInfo": "1000"
}

]
}

Share
10 |10000 characters needed characters left characters exceeded