简体   繁体   English

SAPUI5复制的oData数据已删除

[英]SAPUI5 duplicated oData data remove

I have a question, I got a view where I list all my Data. 我有一个问题,我有一个列出所有数据的视图。 The Data has for example 3 entrys for the day 17.09.2018 but I just want to show only once the day 17.09.2018 and like in my example the ist Zeit and the Soll Zeit , Summe . 数据例如具有3个entrys一天17.09.2018 ,但我只是想表明只有一次的日子17.09.2018 ,并喜欢在我的例子ist ZeitSoll ZeitSumme I just want it to show it once for a day. 我只希望它每天显示一次。

Example: 例:

在此处输入图片说明

As you see here the days repeat and duplicated, like i sad before is there a way to show the summary of the day once? 正如您在这里看到的那样,日子在重复和重复,就像我之前难过的那样,有没有办法显示一天的摘要?

Additional question : Is there a way to implement the days for example Monday - Friday ? 附加问题 :有没有办法实现Monday - Friday这样的日子? Like the 17.09 is a Monday? 17.09是星期一? and the 18.09 is a Tuesday ... ? 18.09是星期二...? in the backend is the date like 20180917 so not the regular date format because of the offset in the calendar I had to change it like this. 后端中的日期是类似20180917的日期,因此不是常规日期格式,因为日历中的偏移量我必须像这样更改它。

You have to format the back-end output data you've got as per your requirement before applying to the model to the view. 您必须先将所需的后端输出数据格式化,然后再应用于视图模型。 For example, for the additional question you've asked you can write the function to get the day from the date. 例如,对于您所询问的其他问题,您可以编写函数以从日期获取日期。

var yyyymmddToDay= function (yyyymmdd) {
    var dateInString = yyyymmdd.toString();
    var year = dateInString.substr(0,4);
    var month = dateInString.substr(4,2);
    var date = dateInString.substr(6,2);
    var dateFormat = year + "-" + month + "-" + date;
    var day = new Date(dateFormat).getDay();
    var weekDay;
    switch(day){
        case 0: 
            weekDay="Sunday";
            break;
        case 1 :
            weekDay="Monday";
            break;
        case 2: 
            weekDay="Tuesday";
            break;
        case 3 :
            weekDay="Wednesday";
            break;
        case 4 :
            weekDay="Thursday";
            break;
        case 5 :
            weekDay="Friday";
            break;
        case 6: 
            weekDay="Saturday";
            break;
    }
    return weekDay;
}

And for removing the duplicates from the data, just maintain an array, iterate through your data and then check if data item is present in the array, if present then don't add it otherwise do it. 为了从数据中删除重复项,只需维护一个数组,遍历数据,然后检查数组中是否存在数据项(如果存在),则不添加它,否则执行此操作。 Thanks. 谢谢。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM