Use ExtJs and JQuery together in one application?

試著忘記壹切 提交于 2020-01-14 12:59:49

问题


we have a big ExtJS (still ExtJs 2) application, which provides windows explorer like functionality on a Java EE server. We now evaluate implementing a new functionality; we could base this functionality on a jQuery plug in.

Is it recommended to use jQuery and ExtJs in one application? Or will I have to deal with side effects occurring?


回答1:


You will not have to deal with any side effect. The only problems I ever ran into when I did this is if I tried to operate on elements that Extjs relied on being left alone. Just make sure that when you start operating using jQuery that you're working inside a div that extjs doesn't plan to mess with. The best way to do this is to inherit from Ext.Component and then operate inside the div it provides. Ext doesn't do anything inside this div so you should be ok. You can also tap into the resize functionality if you need to, though this is not really necessary.




回答2:


My company does so with no problems on a fairly large Apache/Catalyst site. We do use jQuery() rather than $() due to some old Prototype stuff on our site.

More: Blueprint CSS Extjs and JQuery in the same page, best way to make them coexist without conflict




回答3:


keep jQuery within the jQuery namespace http://api.jquery.com/jQuery.noConflict/

Use it like so: $.noConflict();

jQuery only adds a single object (jQuery) to the window's context so you won't have any conflicts.




回答4:


PROBLEM: Some third party libraries for jquery may rely on static webpage organization. As ExtJS components can be added to webpage dynamically - they will have no functions from third party libraries.

SOLUTION: You will have to run this library's script after component is added (use afterrender event, for example). Then you can call these functions on this ext component.



来源:https://stackoverflow.com/questions/14776874/use-extjs-and-jquery-together-in-one-application

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!