2020-09-01 15:12发布
加入QQ群:457200227(SAP S4 HANA技术交流) 群内免费提供SAP练习系统(在群公告中)
最后我找到了解决方案:
我尝试了这个,它工作正常。
查看:-
id =" PC1" singleSelection =" false" showIntervalHeaders =" false" startDate =" {路径:'/startDate'}" rows =" {path:'/people'}" appointmentsVisualization ="已填充" appointmentSelect =" handleAppointmentSelect" intervalSelect =" handleIntervalSelect"> <行> id =" PC2" icon =" {pic}" title =" {name}" text =" {角色}({level})" key =" {empid}" appointments =" {path:'appointments',templateShareable:'true'}"> <约会> <统一:日历约会 startDate =" {start}" endDate =" {end}" icon =" {pic}" title =" {title}" text =" {info}" type =" {type}" color =" {color}" tentative =" {tentative}"> startDate =" {start}" endDate =" {end}" icon =" {pic}" title =" {title}" type =" {type}">
id =" PC1"
singleSelection =" false"
showIntervalHeaders =" false"
startDate =" {路径:'/startDate'}"
rows =" {path:'/people'}"
appointmentsVisualization ="已填充"
appointmentSelect =" handleAppointmentSelect"
intervalSelect =" handleIntervalSelect">
<行>
id =" PC2" icon =" {pic}" title =" {name}" text =" {角色}({level})" key =" {empid}" appointments =" {path:'appointments',templateShareable:'true'}"> <约会> <统一:日历约会 startDate =" {start}" endDate =" {end}" icon =" {pic}" title =" {title}" text =" {info}" type =" {type}" color =" {color}" tentative =" {tentative}"> startDate =" {start}" endDate =" {end}" icon =" {pic}" title =" {title}" type =" {type}">
id =" PC2"
icon =" {pic}"
title =" {name}"
text =" {角色}({level})"
key =" {empid}"
appointments =" {path:'appointments',templateShareable:'true'}">
<约会>
<统一:日历约会
startDate =" {start}"
endDate =" {end}"
title =" {title}"
text =" {info}"
type =" {type}"
color =" {color}"
tentative =" {tentative}">
startDate =" {start}" endDate =" {end}" icon =" {pic}" title =" {title}" type =" {type}">
type =" {type}">
CONTROLLER:-
onInit:函数(){
var data = 0;
var oModel = new sap.ui.model.json.JSONModel();
$。ajax({
网址:"/img/altcal/hana/wfs/services/getRosterInJSON.xsjs",
async:false,
类型:"获取",
dataType:'json',
成功:功能(响应){
数据=响应;
var data1 = {};
var yr = new Date(data.startDate).getFullYear();
var mnt = new Date(data.startDate).getMonth();
var day = new Date(data.startDate).getDate();
data1 [" startDate"] =新的Date(yr,mnt,day);
data1 [" people"] = data [" people"];
for(data [" people"]中的var pIndex){
for(data [" people"] [pIndex] [" appointments"]中的var aIndex){
data1 [" people"] [pIndex] [" appointments"] [aIndex] [" start"] =新的日期(data1 [" people"] [pIndex] [" appointments"] [aIndex] [" start" ]);
data1 [" people"] [pIndex] [" appointments"] [aIndex] [" end"] =新的日期(data1 [" people"] [pIndex] [" appointments"] [aIndex] [" end" ]);
console.log();
data1 [" people"] [pIndex] [" headers"] [aIndex] [" start"] =新的日期(data1 [" people"] [pIndex] [" headers"] [aIndex] [" start" ]);
data1 [" people"] [pIndex] [" headers"] [aIndex] [" end"] =新的日期(data1 [" people"] [pIndex] [" headers"] [aIndex] [" end" ]);
}
oModel.setData(data1); console.log(" view_Shift",data1); }}); this.getView()。setModel(oModel);
},
Hello Mantri Shekar,
我也尝试过这个,但是没有用。
谢谢
Preeti
嗨Preeti,
按如下所示更改JSON对象
"开始":新日期(" 2017-08-13T00:00:00.000Z"),"结束":新日期(" 2017-08-13T00:00:00.000Z"),"标题":" 私有","类型":" Type05"},
这可以工作
此致
Shekar。
你好Sharath,
是的,您的解释是正确的。
我正在运行Planning日历时,却显示出这样的错误,
我得到的日期是{"开始":" 2017-08-14T00:00:00.000Z","结束":" 2017-08-14T00:00:00.000Z"}
计划日历没有采用我从后端获取的日期格式。
正如我所看到的,您是否正在尝试从JSON中读取日期并将其映射到模型中。 将模型绑定到控件时,会出现错误。 解释正确吗?
注意:请详细解释该问题,并发布代码的相关部分。 它会增加您获得回应的机会。
最多设置5个标签!
最后我找到了解决方案:
我尝试了这个,它工作正常。
查看:-
id =" PC1"
singleSelection =" false"
showIntervalHeaders =" false"
startDate =" {路径:'/startDate'}"
rows =" {path:'/people'}"
appointmentsVisualization ="已填充"
appointmentSelect =" handleAppointmentSelect"
intervalSelect =" handleIntervalSelect">
<行>
id =" PC2"
icon =" {pic}"
title =" {name}"
text =" {角色}({level})"
key =" {empid}"
appointments =" {path:'appointments',templateShareable:'true'}">
<约会>
<统一:日历约会
startDate =" {start}"
endDate =" {end}"
icon =" {pic}"
title =" {title}"
text =" {info}"
type =" {type}"
color =" {color}"
tentative =" {tentative}">
startDate =" {start}"
endDate =" {end}"
icon =" {pic}"
title =" {title}"
type =" {type}">
CONTROLLER:-
onInit:函数(){
var data = 0;
var oModel = new sap.ui.model.json.JSONModel();
$。ajax({
网址:"/img/altcal/hana/wfs/services/getRosterInJSON.xsjs",
async:false,
类型:"获取",
dataType:'json',
成功:功能(响应){
数据=响应;
var data1 = {};
var yr = new Date(data.startDate).getFullYear();
var mnt = new Date(data.startDate).getMonth();
var day = new Date(data.startDate).getDate();
data1 [" startDate"] =新的Date(yr,mnt,day);
data1 [" people"] = data [" people"];
for(data [" people"]中的var pIndex){
for(data [" people"] [pIndex] [" appointments"]中的var aIndex){
data1 [" people"] [pIndex] [" appointments"] [aIndex] [" start"] =新的日期(data1 [" people"] [pIndex] [" appointments"] [aIndex] [" start" ]);
data1 [" people"] [pIndex] [" appointments"] [aIndex] [" end"] =新的日期(data1 [" people"] [pIndex] [" appointments"] [aIndex] [" end" ]);
console.log();
data1 [" people"] [pIndex] [" headers"] [aIndex] [" start"] =新的日期(data1 [" people"] [pIndex] [" headers"] [aIndex] [" start" ]);
data1 [" people"] [pIndex] [" headers"] [aIndex] [" end"] =新的日期(data1 [" people"] [pIndex] [" headers"] [aIndex] [" end" ]);
}
}
oModel.setData(data1); console.log(" view_Shift",data1); }}); this.getView()。setModel(oModel);
},
Hello Mantri Shekar,
我也尝试过这个,但是没有用。
谢谢
Preeti
嗨Preeti,
按如下所示更改JSON对象
"开始":新日期(" 2017-08-13T00:00:00.000Z"),"结束":新日期(" 2017-08-13T00:00:00.000Z"),"标题":" 私有","类型":" Type05"},
这可以工作
此致
Shekar。
你好Sharath,
是的,您的解释是正确的。
我正在运行Planning日历时,却显示出这样的错误,
"未捕获的错误:日期必须是JavaScript日期对象;元素sap.m.PlanningCalendar"
我得到的日期是{"开始":" 2017-08-14T00:00:00.000Z","结束":" 2017-08-14T00:00:00.000Z"}
计划日历没有采用我从后端获取的日期格式。
谢谢
正如我所看到的,您是否正在尝试从JSON中读取日期并将其映射到模型中。 将模型绑定到控件时,会出现错误。 解释正确吗?
注意:请详细解释该问题,并发布代码的相关部分。 它会增加您获得回应的机会。
一周热门 更多>