aurelia-ui-toolkits / aurelia-kendoui-bridge

MIT License
117 stars 31 forks source link

Error invoking ContextMenu after version upgrade #767

Closed YaelHal closed 7 years ago

YaelHal commented 7 years ago

Hi, I'm using aurelia-kendoui-bridge and after Aurelia version upgrade I'm getting the following error message:

Inner Error: Message: The kendo control 'kendoContextMenu' is not available. Did you load Kendo (in addition to the bridge)? Inner Error Stack: Error: The kendo control 'kendoContextMenu' is not available. Did you load Kendo (in addition to the bridge)? at WidgetBase.control (http://localhost:32433/jspm_packages/npm/aurelia-kendoui-bridge@1.6.4/common/widget-base.js:58:15) at new ContextMenu (http://localhost:32433/jspm_packages/npm/aurelia-kendoui-bridge@1.6.4/contextmenu/contextmenu.js:23:36) at Object.invoke (http://localhost:32433/jspm_packages/npm/aurelia-dependency-injection@1.3.1/aurelia-dependency-injection.js:448:14) at InvocationHandler.invoke (http://localhost:32433/jspm_packages/npm/aurelia-dependency-injection@1.3.1/aurelia-dependency-injection.js:413:168) at Container.invoke (http://localhost:32433/jspm_packages/npm/aurelia-dependency-injection@1.3.1/aurelia-dependency-injection.js:677:25) at ProviderResolver.get (http://localhost:32433/jspm_packages/npm/aurelia-templating@1.4.2/aurelia-templating.js:2047:74) at Container.get (http://localhost:32433/jspm_packages/npm/aurelia-dependency-injection@1.3.1/aurelia-dependency-injection.js:616:23) at Container.elementContainerGet [as get] (http://localhost:32433/jspm_packages/npm/aurelia-templating@1.4.2/aurelia-templating.js:2102:17) at HtmlBehaviorResource.create (http://localhost:32433/jspm_packages/npm/aurelia-templating@1.4.2/aurelia-templating.js:4

Used the following in main.js:

.plugin('aurelia-kendoui-bridge', (kendo) => { kendo.kendoGrid().kendoTreeView().kendoDatePicker().kendoContextMenu().kendoTooltip().kendoAutoComplete().kendoNumericTextBox().kendoProgressBar();

This used to work before the upgrade, I understand that something was changed as I read in here: https://github.com/aurelia-ui-toolkits/aurelia-kendoui-bridge/issues/742

So what do I need to change ? how to load Kendo?

JeroenVinke commented 7 years ago

Hi @YaelHal

From what version did you update?

YaelHal commented 7 years ago

aurelia-kendoui-bridge from 0.12.2 to 1.6.4 aurelia-dependency-injection from 1.0.0 to 1.3.1 aurelia-templating from 1.1.0 to 1.4.2

JeroenVinke commented 7 years ago

Oh yeah, that's quite an update :)

This is the release that introduced a breaking change: https://github.com/aurelia-ui-toolkits/aurelia-kendoui-bridge/releases/tag/1.0.0-beta.1.0.1. Basically, you'll need to load Kendo controls yourself. If you use the ContextMenu wrapper of the bridge then you also need to load the Kendo ContextMenu control. This can be done through a module loader or through a script tag in index.html, whatever you prever. I suspect you're using JSPM, which means that your module loader is already configured, so you'd only have to do import 'kendo.contextmenu.min', or something like that. Let me know if you have issues

YaelHal commented 7 years ago

Thanks! So I should remove (kendo) => { kendo.kendoGrid().kendoTreeView().kendoDatePicker().kendoContextMenu().kendoTooltip().kendoAutoComplete().kendoNumericTextBox().kendoProgressBar(); From main.js and use import whenever I use kendo controls ?

JeroenVinke commented 7 years ago

You need both,

(kendo) => { kendo.kendoGrid().kendoTreeView().kendoDatePicker().kendoContextMenu().kendoTooltip().kendoAutoComplete().kendoNumericTextBox().kendoProgressBar();

This loads the aurelia-kendoui-bridge wrappers, but not the Kendo controls. An import statement would do that

YaelHal commented 7 years ago

I Added the import and it works, no error. Thanks !

JeroenVinke commented 7 years ago

Great!