简体   繁体   English

SAPUI5中的jQuery日期选择器

[英]jQuery Date Picker in SAPUI5

I know SAPUI5 is using jQuery Date Picker . 我知道SAPUI5使用的是jQuery Date Picker But I can't see any option in SAPUI datepicker to disable the past date in the picker. 但是我在SAPUI datepicker中看不到任何选项来禁用选择器中的过去日期。

<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 通过禁用过去的日期,我认为你的意思是设置jQueryUI DatePickers的最小日期

something like setting min date in jquery datepicker 类似于在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); 
     }
 });
}());

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

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