step 1: create a folder on web content ..such that webcontent/yourjsonfile/kkk.json
Step2:
in your controller oninit()
just add the
var oBusy = new sap.m.BusyDialog();
var oModel = new sap.ui.model.json.JSONModel();
oModel.attachRequestSent(function() {
oBusy.open();
});
oModel.loadData("myfoldername/kkk.json");
oModel.attachRequestCompleted(function() {
oBusy.close();
});
// oModel.setData(mData);
this.getView().setModel(oModel);
step 3:
<Table id="table" items="{/ProductCollection}" mode="Delete" delete="odelete">
<columns>
<Column>
<Text class="firstname_class" text="First Name" />
</Column>
<Column>
<Text class="lastname_class" text="Last Name" />
</Column>
</columns>
<items>
<ColumnListItem id="list">
<cells class="cellclassdata">
<Link id="link" text="{Category}" press="handlePress" />
</cells>
<cells>
<Text class="shipcity_class" text="{Category}" />
</cells>
</ColumnListItem>
</items>
</Table>
step4:
sample kkk.json
{
"ProductCollection": [
{
"ProductId": "1239102",
"Name": "Power Projector 4713",
"Category": "Projector",
"SupplierName": "Titanium",
"Description": "A very powerful projector with special features for Internet usability, USB",
"WeightMeasure": 1467,
"WeightUnit": "g",
"Price": 856.49,
"CurrencyCode": "EUR",
"Status": "Available",
"Quantity": 3,
"UoM": "PC",
"Width": 51,
"Depth": 42,
"Height": 18,
"DimUnit": "cm",
"ProductPicUrl": "https://openui5.hana.ondemand.com/test-resources/sap/ui/demokit/explored/img/HT-6100.jpg"
},
{
"ProductId": "2212-121-828",
"Name": "Gladiator MX",
"Category": "Graphics Card",
"SupplierName": "Technocom",
"Description": "Gladiator MX: DDR2 RoHS 128MB Supporting 512MB Clock rate: 350 MHz Memory Clock: 533 MHz, Bus Type: PCI-Express, Memory Type: DDR2 Memory Bus: 32-bit Highlighted Features: DVI Out, TV Out , HDTV",
"WeightMeasure": 321,
"WeightUnit": "g",
"Price": 81.7,
"CurrencyCode": "EUR",
"Status": "Discontinued",
"Quantity": 10,
"UoM": "PC",
"Width": 34,
"Depth": 14,
"Height": 2,
"DimUnit": "cm",
"ProductPicUrl": "https://openui5.hana.ondemand.com/test-resources/sap/ui/demokit/explored/img/HT-1071.jpg"
}
]
}
No comments:
Post a Comment