且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在jqgrid中添加datepicker

更新时间:2023-09-25 20:01:28

问题是在页面上放置了某些版本的jqGrid调用dataInit 之前的el.因此,jQuery UI Datepicker在这种情况下不起作用.您可以通过调用datepicker 以后:

The problem is that some versions of jqGrid calls dataInit before the el are placed on the page. So jQuery UI Datepicker don't work in the case. You can fix the problem by calling datepicker later:

dataInit: function (el) {
    setTimeout(function () {
        $(el).datepicker({dateFormat:'yy-mm-dd '});
    }, 50);
}