AnsweredAssumed Answered

How to load jQuery plugins on Web AppBuilder?

Question asked by madalinul on Oct 18, 2016
Latest reply on Oct 20, 2016 by madalinul

So I am trying to build a widget which uses some jQuery  plugins(jquery ui, jquery mobile and so on). The problem is that I can't figure out how to load this plugins. If i put the plugins in the dependencies array it doesn't work because jQuery isn't loaded first.

 

 

define(['dojo/_base/declare', 'jimu/BaseWidget',
  'jimu/loaderplugins/jquery-loader!https://code.jquery.com/jquery-git1.min.js',
'./lib/jquery.mobile.min', './lib/jquery.ui.min'],
function(declare, BaseWidget, $){
  return declare(BaseWidget, {
    startup: function(){
      var map = this.map;
      $('.jimu-widget-use-jquery .map-id').click(function(){
        alert(map.id);
      });
      $('.jimu-widget-use-jquery .my-title').text('title added by jquery.');
    }
  });

 

Any tips on how can I achieve this? Thanks

Outcomes