Forum Discussion

whileoneloop's avatar
whileoneloop
New Member
9 years ago
Solved

Exception raised when using Telerik Kendo UI components in PowerBI's visualsandbox

 

Attempting to use an external UI library (Telerik Kendo UI) and receiving the following exception:

 

--

Uncaught TypeError: Illegal invocation
at <anonymous>:562:21817
at <anonymous>:562:27218
at <anonymous>:563:18554
at <anonymous>:563:18651
at t.kendo.t.kendo.cultures (<anonymous>:562:21)
at Window.<anonymous> (<anonymous>:562:59)
at <anonymous>:841:20
at Object.r [as injectJsCode] (visualhostcore.min.js:2)
at i.loadWithoutResourcePackage (visualsandbox.min.js:1)
at i.executeMessage (visualsandbox.min.js:1)

--

 

A compatible version of jquery is loaded and initialised before the Telerik component js.  A repoduction is available here:

 

https://github.com/whileoneloop/kendo-ui-power-bi-visual

 

An issue has been posted in the PowerBI-visuals git repo:

 

https://github.com/Microsoft/PowerBI-visuals/issues/239

 

Have also sent a support ticket to Telerik.

 

Has anyone been able to load Kendoui in the PowerBI sandbox?

  • You have to include these code into your code:

    Object.defineProperties(window, {
        'devicePixelRatio': {
            get: function () {
                return window.window.devicePixelRatio;
            }
        },
        'innerWidth': {
            get: function () {
                return window.window.innerWidth;
            }
        }
    });
    
    var kendo = { cultures: {} };
    window.kendo = kendo;
    window.window.kendo = kendo;

    Please take a look at this pull request.

     

    Ignat Vilesov,

    Software Engineer

     

    Microsoft Power BI Custom Visuals

    [email protected]

2 Replies

  • v-viig's avatar
    v-viig
    Community Champion

    You have to include these code into your code:

    Object.defineProperties(window, {
        'devicePixelRatio': {
            get: function () {
                return window.window.devicePixelRatio;
            }
        },
        'innerWidth': {
            get: function () {
                return window.window.innerWidth;
            }
        }
    });
    
    var kendo = { cultures: {} };
    window.kendo = kendo;
    window.window.kendo = kendo;

    Please take a look at this pull request.

     

    Ignat Vilesov,

    Software Engineer

     

    Microsoft Power BI Custom Visuals

    [email protected]

    • drewhaller's avatar
      drewhaller
      Frequent Visitor

      This no longer works when upgrading api from 1.7.0 to 2.3.0 or 2.5.0.

      it seems the 2 properies are no longer need but later and issue is faced where code this.kendo.util  throws TypeError: Cannot read property 'util' of undefined.  In running their samples this refers to window object so not clear why this is failing due to pbiviz api update.  

       

      Anyone know how to resolve this ?