2017 June Release

jQuery - Everywhere?Permanent link for this heading

In GUI controls you can use jQuery (fscjq) and benefit from the library but there is no necessity to use it. Good old plain JavaScript does the job, too.

Another case is that you already have a standard jQuery plug-in. Since the Fabasoft product provides fscjq instead of $ it is a bit tricky. To be able to use the jQuery plug-in functions with fscjq you have to provide a prepare.js and a cleanup.js file.

Example

app.ducx Object Model Language

instance ControljQuery CustomCalControl {
  ...
  lookelements<lookbasename, COOSYSTEM@1.1:component, lookcontent> = {
    { "prepare.js", FSCCONTROLSAMPLE@1.3285, file("resources/js/prepare.js") },
    { "jquery.plugin.js", FSCCONTROLSAMPLE@1.3285, file("resources/js/jquery.plugin.js") },
    { "render.js", FSCCONTROLSAMPLE@1.3285, file("resources/js/render.js") },
    { "cleanup.js", FSCCONTROLSAMPLE@1.3285, file("resources/js/cleanup.js") }
  }
}

prepare.js

if ($ && $.noConflict) {
  window._$ = $.noConflict(true);
}

if (jQuery && jQuery.noConflict) {
  window._jQuery = jQuery.noConflict(true);
}

$ = jQuery = fscjq;

cleanup.js

fscjq = jQuery.noConflict(true);

if (window._$) {
  window.$ = _$.noConflict(true);
  delete window._$;
}

if (window._jQuery) {
  window.jQuery = _jQuery.noConflict(true);
  delete window._jQuery;
}