Is jQuery compatible with ExtJS? - javascript

I believe Ext.js was using jQuery, but I'm not sure. Does anyone know if there is full compatibility with jQuery and Ext.js?

Ext.js is completely independent of jQuery and as such does not rely on jQuery in any way. Don't know what you mean by 'full compatibility' but you can use both on the same page as they don't interfere with each other.
As Ext.js doesn't use the $-function, you don't even have to do any special trickery to get them to work together, as is the case with using Prototype with jQuery, for example.

You should be able to find some answers on the jquery site where it talks about using jQuery with other libraries.
Hope this helps some.

For ExtJS 3 for example, you need to follow a given loading order for these libraries AND load the ExtJS jQuery adapter.
See http://www.extjs.com/learn/Ext_Getting_Started for details :
jQuery (1.1+) jquery.js
jquery-plugins.js // required jQuery plugins
ext-jquery-adapter.js
ext-all.js (or your choice of files)

I think jQuery (core) and ExtJS are very compatible. I prefer to start new projects using both; in fact, flot.js demands jQuery - and flot.js is very nice - so in nearly every project I use both jQuery and ExtJS. Go for it!
Though ExtJS has made strides in their DOM manipulation and traversal utilities (core), nothing beats the elegance of jQuery (core). However, I prefer ExtJS (UI) to jQuery UI; I find it is much more homogeneous (and capable) than jQuery UI.

Upto Extjs 3.XX, adapters were configurable.
But Sencha (Ext4) onwards, there is no separate adapters, instead we have ExtCore.

No more other libraries
ExtJS used to be built on top of other libraries. With version 2 they had their own but still offered the possibility to use other libs. But not anymore with version 3. ExtJS core code is very very mature, very efficient and VERY tidy. If you ask me, their code is written a lot better than jQuery's but that's subjective.
Combine with jQuery with no tricks
Anyway. If you intend to use ExtJS but would like to use other libs as well you can still do that. But if you think that you'd rather use jQuery with ExtJS I suggest you don't do that, because your code will have many hacks to overcome differences. I would rather use just ExtJS. You'll like it and probably won't want to switch back anymore.

Related

Custom building jQuery

I'm using jQuery for a mobile app, but I don't use all or even half of its modules so I'm looking to nix those and reduce the size a bit. (No, I don't want to use Zepto or other libraries for some reasons).
There was one: projects.jga.me/jquery-builder/ but its not maintained anymore.
jQuery Uncompressed: http://pastebin.com/CwUT9U8p
Wondering which functions/modules I can safely remove, any pointers would help.
you can use grunt to build the jquery modules you want to use into a custom version of jquery, it's documented on the jquery git repo here
It's worth noting though that jquery uses a lot of internal code calls, so even a trimmed down version wont be as small as you might like (possibliy not even as small as a minified gzip version of the full lib)
If you are only wanting sizzle and getJson have you though of using the stand alone sizzle lib and a lightweight json ajax wrapper? there are microlibs for ajax/json here

What is jQuery.Class?

I'm wondering what the following code is doing:
jQuery.Class("Vtiger_Helper_Js",{ });
I'm asking because I can't figure out what jQuery.Class is about...
The vtiger CRM uses the jQuery.Class plugin, available here.
You can see it in the repository in the libraries folder.
This is what is called jQuery.class.js which is a plugin to supersede prototype.js basically since jQuery is huge now.
Several of the methods in this plugin use code adapated from Prototype
Meaning they basically made jQuery and prototype.js one language to easily transition those who use prototype.js to jQuery or at least help thme

jQuery and Windows 8 JavaScript Metro Style Apps

Can jQuery be used in Windows 8 Metro-style apps developed using the JavaScript API? I'm looking at the samples, and there's a lot of standard DOM manipulation like document.getElementById, addEventListener, etc. I'd like to use jQuery for productivity.
The $ is not magic. jQuery is just a javascript library. It should run fine.
The only thing that might not work are cssHooks which won't take into account any 'quirks' of their environment.
So yes, it will work, if you trust Microsoft to produce an environment that follows the HTML/CSS/JS specifications.
Do you feel lucky?
Yes, it works, as will any JavaScript library. I verified it on one of the tablets they gave out at the BUILD conference.
However, do not expect to use a CDN to load in the script. You have to download it, add it to the project, and reference it locally.
tl;dr : you can use jQuery 1.7+, but it's not (yet?) fully integrated when markup modification is involved.
Quote from the Dev Center (msdn)
Using jQuery
You can use jQuery in your Windows Store app using JavaScript, but only versions 1.7 and later. We recommend always using the latest version.
That means that it will work, but you will encounter some non-standard behaviors as listed in the HTML and DOM API changes list (msdn)
There are exceptions mentioned when setting the innerHtml property (among others : Making HTML safer) if there is unsafe markup, but this is non-blocking and the simple fact of loading the jQuery library (1.8.2) will trigger a few.
As mentioned before, you do need to use a local copy of the library (no CDN).
You can use any JS library. I suspect that methods like WinJS.xhr (aka '$.ajax') where written so that WinJS doesnt have a dependency on jQuery.
It should run fine. jQuery is just a library. The $('#someid') will internally call the document.getElementById You can use it just as if you can use the javascript code you write yourself...
JQuery should work fine but bear in mind there is some built in functionality for doing this kind of thing, in the case of your example:
WinJS.Utilities.query("#someId li")
.listen("click", function (result) {
Query Collection Documentation
Don't use any windows libraries like WinJS. Why would you want to lock yourself and be dependent on proprietary code? Stick with the usual stuff, i.e. HTML, CSS, JS(JQuery or otherwise). It will only make your future support/dev far more predictable ...
As with all third party JavaScript libraries there are a couple of things you should keep in mind.
Always try to include the .js sourcefile in your project when possible. Calling out to a CDN or external hosted location will flag you for some security checks you wouldn't normally have to go through.
I have used a couple of jQuery versions in coding my own apps. Some of them broke so keep in mind there is still no guarantee. Other libraries, like SoundJS, I used older versions that I know do work.
If you are looking for some examples of third party libraries I have some posts on Knockout and Upshot here:
http://blogs.msdn.com/b/davedev/archive/2012/05/02/connecting-to-wcf-ria-services-in-a-windows-8-metro-style-app-using-upshot-js-and-kockout-js.aspx
I have also written a free Windows Store Gaming Kit that uses third party libraries you can grab the free source for that here: http://win8gamekit.codeplex.com
Actually you can download it through Visual Studio. If you download NuGet Package Manager.
TOOLS->Add Packages & Extensions
Search the left online packages for NuGet Package Manager and install.
Then when in a project that you want jQuery, right click on your references and add a NuGet package, and search jQuery. That's what I use.

Can jQuery be used with Ext.js?

After reading some of the jQuery vs ext js questions here and google search result, my understanding is that ext js is a UI building library and jQuery is a more fundamental javascript framework. I've used jQuery for a while now. It's pretty cool but in general a better (much better) javascript.
So my question is: how easy is it to use jQuery for DOM navigation/manipulation and Ext.js for UI in the same project?
There is a page on jQuery website. But the demo is too simple and the external links to Ext.js are all dead.
I'm sure it's possible, but what sort of problems and challenges would I be facing?
You might be wondering why I want to do this. Well, the Ext.js set of UI just looks much better/more polished/more feature rich then jQuery UI. I'm particularly interested in the grid.
Thanks!
Using both libraries side by side is not an issue in the technical way (just add the jquery within a script-tag, that's it!). However, you should not use jQuery for ExtJS' stuff or vice versa. Well, unless you know exactly what you do.
The actual issue can be DOM manipulations (jQuery or ExtJS Core) outside of an ExtJS component that affect an existing component.
So, in a nutshell: You can use DOM manipulations when it will not affect the ExtJS components. Otherwise use the proper way within the component itself.
Well you dont need both the libraries to live together.. Extjs has DOM manipulation api too probably not as vast as jquery but it does have the basic stuff.
Coming to Jquery, jquery has UI building APIs too if not rolled into the library there are vast no of extensions for all kinds of problems. Just try googling whatever UI you are building now with respect to jquery and you will find a library for sure.. There is jquery templates too that lets you generate HTML markup from a template defined by you and applying data objects (json) to it.. Jquery has a vast community too so most of your questios or concerns will be addressed by the community almost instantly..
So yea my suggestion would be to choose one library and stick to it and contribute to the library if there are many missing features..
Lastly I would suggest you choose Jquery.. It rocks.. period..
I think you would have no problem do this stuff... Make Ext.js your main jQuery library and jQuery as the data manipulation library for the DOM.
There would be no problem or conflicts because jQuery is compatible with other javascript libraries.

Is there a lightweight library to do draggable+sortable lists inside greasemonkey scripts?

I'm writing a GreaseMonkey script, as part of which I'd like to sort a list by dragging its items. I'm using mootools, but the component for sortable lists doesn't work in the GM sandboxed environment. Can you recommend a smallish library/piece of code to do list sorting in the most lightweight fashion? I want it to be independant of any large framework and don't feel like implementing it myself.
If you need to debug a library such as mootools, instead of #require-ing it, just copy/paste the entire source into your own script. Then you can debug it the same as your own code.
On another note, this script includes the ability to drag-and-drop it's own window around the screen, with no additional library. Maybe you could analyze it and borrow code?
Use this Javascript QuickSort implementation
I'm not sure if there are any particular issues with just MooTools, but in general you may include external scripts into a GreaseMonkey script.
This has been addressed in previous questions like this one or this, as well as on the GreaseSpot wiki.

Categories