on 02-23-2019 2:58 PM
Hello Experts, I need help in one requirement. I have to show same kind of information on click of 3 separate Generic tiles in sap ui5. On click of first time need to show title, image and description similarly for the other tiles as well same field but data would be different. It is JSON model and I have prepared json file in default model same json file path has been defined. I can access data in case of first tile click but in other cases getting below error. I have used manifest.json configuration no controller code here. Error : "Assertion failed: list bindings support only a single template object" manifest.json code : "dataSources": { "init_data": { "uri": "model/data.json", "type": "JSON" } } "": { "type": "sap.ui.model.json.JSONModel", "dataSource": "init_data" } Json file structure : { "hrAppCollection": [{ "Heading": "TimeSheet Entry app", "AppPicUrl": "./image/timesheet.jpg", "PlaceHolderText": "Approval of Firefighter Access Request submitted for Production system instances." }, { "Heading": "Approve Firefighter Request", "AppPicUrl": "./image/timesheet.jpg", "PlaceHolderText": "Approval of Firefighter Access Request submitted for Production system instances." }] } I have tried using named model concept and did some json file data manipulation but I am not able to figure out how to achieve this. Let me know if you need any further information on the same. BR, RK
Hello ram mishra,
Please understand you Products.json file. It contains the array of data so you have to select properly which data you want to show.
For example purpose I have selected first one.You can refer the screenshot.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi ram mishra,
You need to load odata models in the data sources as far as I know.. You just need to enter the data at the models and mention the URI..
In your same project's manifest.json. Just add the below lines of code it will load the JSON data and set it the test and test1 models respectively.
If you don't want a name for the model it then don't give any name there just pass "". But remember there can be only one nameless model for a control.. So for the component, there can be only one. So for other models you need to provide name.
"models": {
"i18n": {
"type": "sap.ui.model.resource.ResourceModel",
"settings": {
"bundleName": "com.newtiles.Znewtilesovp.i18n.i18n"
}
},
"test": {
"type": "sap.ui.model.json.JSONModel",
"uri": "./mockdata/scmapp.json",
"preload": true
},
"test1": {
"type": "sap.ui.model.json.JSONModel",
"uri": "./mockdata/products.json",
"preload": true
}
},
Alternatively you can load all the data in a single model.. Just prepare your data in the below format:
{
"scmAppCollection":[{...},{...},{...}],
"anotherProperty":[{...},{...},{...}]
}
BR,
Mahesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Really appreciate your help and support. I have tried all these things in my case but nothing worked.
Named Model concept (creating model by different names) and changes in the json file as you suggested. You can also check in my code.
I am getting below error in the console.
Error : "Assertion failed: list bindings support only a single template object"
BR,
RK
Hi ram mishra
You might be missing some small thing there in your project.. Attaching your updated project.. I changed it to named model.
https://github.com/mahesh0431/testTemp.git
BR,
Mahesh
Hi Mahesh,
Please find attached step by step screenshot to show my issue. My real issue is still not fixed first time it triggers but in case of 2nd time model triggeres blank data with attached error.
Multiple json file instantiation.docx
https://github.com/rkmishra2703/RK-
BR,
RK
Hi ram mishra,
The error is coming because you are having 2 controls inside the carousel
<Carousel xmlns="sap.m" id="carousel0" pages="{test1>/ProductCollection}">
<VBox id="vbox0">
<Text text="Timesheet Entry App"/>
<Image src="./image/timesheet.jpg" height="30%" width="20%"/>
<Text xmlns="sap.m" text="Used to achieve time sheet entry capture and get approval." id="text2"/>
<f:Card>
<f:header>
<cards:Header title="{Name}" subtitle="{Description}" iconSrc="{ProductPicUrl}" iconDisplayShape="Square"/>
</f:header>
<f:content>
<VBox class="sapUiSmallMargin">
<HBox>
<Label text="Supplier" class="sapUiTinyMarginEnd"/>
<Text text="{SupplierName}"/>
</HBox>
<HBox>
<Label text="Status" class="sapUiTinyMarginEnd"/>
<Text text="{Status}"/>
</HBox>
</VBox>
</f:content>
</f:Card>
</VBox>
<!--<VBox id="vbox1">-->
<!-- <Text text="Page 2"/>-->
<!--</VBox>-->
</Carousel>
If you comment the other vbox : vbox1, then the error will gone..
Please check and confirm.
BR,
Mahesh
User | Count |
---|---|
91 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.