简体   繁体   中英

I can not filter a list in a date range SAPUI5

I have a problem:

<DateRangeSelection delimiter= "-" displayFormat="yyyy/MM/dd" 
      dateValue="{path:'/dateValueDRS1'}" secondDateValue="{path:'/secondDateValueDRS1'}"
      minDate="{path:'/dateMinDRS1'}" maxDate="{path:'/dateMaxDRS1'}" 
      change="handleChange"/>
handleChange: function(oEvt) {
    var filters = [];

    var query = oEvt.getParameter("query");

    if (query) {
        var to_dat = new Date(to);
        var to_dt = to_dat.toISOString();
        var oFilter = new sap.ui.model.Filter("CreatedAt", sap.ui.model.FilterOperator.BT, from_dt, to_dt);

        filters.push(oFilter);

        var list = this.getView().byId("list");
        var oBinding = list.bindAggregation("items");
        oBinding.oFilter(filters);
    }
},

With SAPUI5, I can not filter a list in a date range.

My list (example of a date on my list: 05/11/2014 )

If CreatedAt is of type edm.datetime commenting this line should do the trick.from date also should be date object.

//var to_dt = to_dat.toISOString();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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