Search This Blog

Wednesday, June 10, 2015

Jquery Cons and Pros in Microsoft CRM 2015

Use jQuery with HTML web resources
We recommend that you use jQuery together with HTML web resources to provide user interfaces because it is an excellent cross-browser library.
With HTML web resources, you control the libraries that are present and there is no restriction against manipulating the DOM. Feel free to use jQuery within your HTML Web resources.
Avoid using jQuery with form scripts or ribbon commands
We do not recommend using jQuery in form scripts and ribbon commands.
Most of the benefit provided by jQuery is that it allows for easy cross-browser manipulation of the DOM. This is explicitly unsupported within form scripts and ribbon commands. Restrict your scripts to use the Xrm.Page and Xrm.Utility libraries available in form scripts and ribbon commands. If you decide to use the remaining capabilities of jQuery that are useful with Microsoft Dynamics CRM and include the ability to use $.ajax, consider the following:
·         For best performance, don’t load jQuery in the page if you do not need it 
·         Using $.ajax to perform requests against the OData and Modern Apps SOAP endpoint is supported, but there are alternatives. The alternative to using $.ajax is to use the browsers XMLHttpRequest object directly. The jQuery $.ajax method is just a wrapper for this object. If you use the native XMLHttpRequest object directly, you do not need to load jQuery.

Compare the SDK.REST.js and SDK.JQuery.js sample libraries found in Sample: Create, retrieve, update, and delete using the OData endpoint with JavaScript and Sample: Create, retrieve, update, and delete using the OData endpoint with JavaScript and jQuery. Both perform the same operations, but SDK.REST.js doesn’t require jQuery.
·         Each version of jQuery that is loaded in a page can be a different version. Different versions of jQuery have different behaviors and these can cause problems when multiple versions of jQuery are loaded on the same page. There is a technique to mitigate this, but it depends on editing the jQuery library and any other libraries that depend on jQuery. More information: jQuery and jQuery UI with Dynamics CRM 2011 & 2013jQuery.noConflict()


2 comments:

Note: Only a member of this blog may post a comment.