简体   繁体   中英

jQuery Date Picker in SAPUI5

I know SAPUI5 is using jQuery Date Picker . But I can't see any option in SAPUI datepicker to disable the past date in the picker.

<commons:DatePicker 
         width="11em" 
         id="date2" 
         change="date" 
         locale="de-DE" 
         placeholder="{
                    path : 'modelQmTestDetails>EndDate',
                    formatter : 'util.Formatter.sDate'
         }"
         tooltip="Edit End Date"> 
</commons:DatePicker >

Is there any option for that?

Edit:

My application's main file,

(function () {
    "use strict";

    jQuery.sap.declare("Application");
    jQuery.sap.require("sap.ui.app.Application");
    jQuery.sap.require("model.Config");
    jQuery.sap.require("jquery.sap.history");
    jQuery.sap.require("jquery.sap.storage");
    jQuery.sap.require("util.ServiceConfig");

    sap.ui.app.Application.extend("Application", {
        init: function () {

        },

        main: function () {
            // create app view and put to html root element
            var root = this.getRoot();
            sap.ui.jsview("app", "view.App").placeAt(root);
        }
    });
}());

My controller file,

jQuery.sap.require("util.Formatter");
jQuery.sap.require("util.Networkaccess");

sap.ui.controller("view.QM.QmMaster", {

    onInit: function () {

    },

    onBeforeRendering: function (evt) {
    },

    onAfterRendering: function (evt) {

    },

    onExit: function () {

    },
});

By disable past date I take it you mean set the jQueryUI DatePickers minimum date

something like setting min date in jquery datepicker

You could try to extend the control and change the defaults

(function() {
 jQuery.sap.declare("openui5.DatePicker");
 jQuery.sap.require("sap.ui.commons.DatePicker");
 sap.ui.commons.DatePicker.extend("openui5.DatePicker", {
     renderer: {
     },

     init: function() {
         if (sap.ui.commons.DatePicker.prototype.init) {
             sap.ui.commons.DatePicker.prototype.init.apply(this, arguments);
         }
         var defaults = jQuery.datepicker._defaults;
         defaults.yearRange = '2014:2034';
         defaults.minDate = new Date();
         jQuery.datepicker.setDefaults(defaults); 
     }
 });
}());

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