Kendo & Aurelia: jQuery (...). KendoPager is not a function

I'm trying to get Kendo to work in Aurelia and it's not too easy ...

The following call inside the attached () hook VM calls "jQuery (...). KendoPager is not a function" exception in shim.min.js: 1444:

jQuery("#pager").kendoPager({
  dataSource: dataSource
});

      

I've experimented with several ways of defining the GlobalBehavior.jQueryPlugins () parameter like this, my best attempt so far in main.js:

import {GlobalBehavior} from 'aurelia-templating-resources';
GlobalBehavior.jQueryPlugins["kendopager"] = "kendoPager";

      

Unfortunately, there is little documentation on this, so you do some part-time jobs in the dark, so any help would be appreciated.

Normal jQuery functions work just fine, so the problem seems to be with Kendo use.

Thank you in advance

+3


source to share


1 answer


You have installed a dependency with JSPM, but you also need to import it into your VM class file. Place this import statement at the beginning of the file:

import {kendoUi} from 'kendo-ui';

      

After that, you can use in the attached

hook:

jQuery("#pager").kendoPager({
  dataSource: dataSource
});

      



Just one side note, it's best not to refer to DOM elements, but to hardcode them. You are better off linking to the element in the template

<div ref="pager"></div>

      

and then in a model like

jQuery(this.pager).kendoPager({
  dataSource: dataSource
});

      

+1


source







All Articles