开发者

how to use filament's daterangepicker with new jquery?

开发者 https://www.devze.com 2023-01-21 20:20 出处:网络
I downloaded the daterangepicker available here : filament group I am using jQuery 1.4.x version in my page, and all other plugins I am using are supported only on latest version of jQuery.

I downloaded the daterangepicker available here : filament group

I am using jQuery 1.4.x version in my page, and all other plugins I am using are supported only on latest version of jQuery. The daterangepicker tool fails because it is using date.js (which uses a very old jQuery).

If I use datepi开发者_Python百科cker, all other plugins and functionality of rest of the plugins I am using are lost.

I went through filament group's comments and found this :

@ Mckensy: We made sure to use “jQuery” instead of $ to prevent such collisions but it appears the date.js library uses $, which is probably causing your conflict. Maybe you could try replacing their $ variables with something else.

he means that noConflict mode doesn't work and only way is to change date.js.

Now can someone please tell me how to do what he says ??


It's been worked on some at: https://github.com/filamentgroup/jQuery-UI-Date-Range-Picker

Deploying this worked for me on jqueryUI 1.8.9.


Try wrapping your date.js code in a (function(){})() and inside this function at the end all the date.js code, assign a global variable so you can reference the local data.js $ variable.

(function() {

// date.js code
var $ = someDataJsStuff();

// .. more code ..

// make a global var to reference this date.js stuff (not $ of course)
dateJsVariable = $;

})();

This will avoid any namespace cluttering. Only that final global variable will clutter so that you can use the library :)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号