0
sapui5 MVC CRUD 응용 프로그램을 만들었습니다. 도움이 필요합니다.SAPUI5 - MVC CRUD 테이블 데이터 없음
- 왜보기에 데이터가 없습니까?
- 바인딩 문제입니까?
- 내 CRUD.view.xml이 맞습니까?
- 어떻게 JSON 데이터를 별도의 파일로 호출 할 수 있습니까? sap.ui.resource() 또는 jQuery.sap.getModulePath()
- 솔루션은 무엇입니까?
CRUD.controller.js 단순히 <Table ... items="{/ApplicationCollection}">...
를 사용하고 작동합니다 기능
onInit: function() {
// JSON data normally on a seperate file
var oData = {
ApplicationCollection : [
{
"applicationId" : "0001",
"name" : "John Doe",
"connectionPath" : "index.html",
"imagePath" : "Image Path",
"subApplicationId": "Sub ID",
"status": "active"
},
{
"applicationId" : "0002",
"name" : "Jane Doe",
"connectionPath" : "index.html",
"imagePath" : "Image Path",
"subApplicationId": "Sub ID",
"status": "active"
},
{
"applicationId" : "0003",
"name" : "Mary Jane",
"connectionPath" : "index.html",
"imagePath" : "Image Path",
"subApplicationId": "Sub ID",
"status": "active"
},
{
"applicationId" : "0004",
"name" : "Bob Foo",
"connectionPath" : "index.html",
"imagePath" : "Image Path",
"subApplicationId": "Sub ID",
"status": "active"
}
]
};
var oModel = new sap.ui.model.json.JSONModel();
oModel.setData(oData);
this.getView().setModel(oModel);
}
CRUD.view.xml
<mvc:View
controllerName="sap.ui.crud.view.CRUD"
xmlns:mvc="sap.ui.core.mvc"
xmlns="sap.m">
<Table
id="idProductsTable"
inset="false"
items="{
path: '/ApplicationCollection'
}">
<headerToolbar>
...
</headerToolbar>
<columns> <!-- Columns Header -->
...
</columns> <!-- End of Columns Header -->
<items> <!-- Column List -->
<ColumnListItem>
<cells>
<Text
text="{applicationId}" />
<Text
text="{name}" />
<Text
text="{connectionPath}" />
<Text
text="{imagePath}" />
<Text
text="{subApplicationId}" />
<Text
text="{status}" />
</cells>
</ColumnListItem>
</items> <!-- End of Column List -->
</Table>
</mvc:View>
1. 아직 데이터가 작동하지 않았습니다. 4. 시도해보고 구문 분석 오류가 발생합니다. JSON 데이터에 대해 Component.js에서 무언가를 구성해야합니까? – user3744197
1. 위의 업데이트 대답을 확인하십시오. 그러면 코드에 다른 문제가있을 것입니다. 4. 아니, 예상대로 작동해야합니다. JSON 파일이 유효합니까? – Qualiture
Q1. 나는 JS 뷰 버전에서 작동하지만 XML에서는 작동하지 않는다. 예, {/ ApplicatonCollection}으로 바꿉니다. Q4. 나는 그것의 유효하다고 확신한다. 아마도 다시 시도하거나 내 인터넷 사용 정보를 삭제하려고 시도 할 것입니다. – user3744197