JavaScript UI Libraries & Blazor Components Suite – Smart UI Forums Gantt Uncaught TypeError: Cannot read property 'constructor' of undefined

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #101733
    187
    Member

     
    I am implementing smart chart in my Vue JS + .Net 5.0.
    Vue Cli version is 4.5.12
    When initially load, pie chart comes but when we refresh page, it give below error,
    Uncaught TypeError: Cannot read property ‘constructor’ of undefined
    at HTMLElement.value (smart.button.js?88ec:8)
    and pie charts not visible.
    Thank you
     

    #101736
    yavordashew
    Member

    Hi rr@187,
    Thank you for contacting us!
    I have tried to reproduce the issue that you encounter but with no success.
    I would like to ask you to create a code example for us that recreates this error in order to give you a solution for it.(jsfiddle or github repository for example)
    However looking at the log that you shared it appears that the error my be coming from a smart-button element.
    Please, do not hesitate to contact us if you have any additional questions.
    Best regards,
    Yavor Dashev
    Smart UI Team
    https://www.htmlelements.com/

    #102525
    rahul kumar
    Participant

    In JavaScript almost everything is an object, null and undefined are exception. if a variable has been declared, but has not been assigned a value, is automatically assigned the value undefined . Therefore, if you try to access the value of such variable, it will throw Uncaught TypeError cannot set property ‘0’ of undefined/null .

    JavaScript null and undefined is one of the main reasons to produce a runtime errors . This happens because you don’t check the value of unknown return variables before using it. If you are not sure a variable that will always have some value, the best practice is to check the value of variables for null or undefined before using them. The standard way to catch null and undefined simultaneously is this:

    if (variable == null) {
    // your code here.
    }

    Because null == undefined is true, the above code will catch both null and undefined.

    Also you can write equivalent to more explicit but less concise:

    if (variable === undefined variable === null) {
    // your code here.
    }

    This should work for any variable that is either undeclared or declared and explicitly set to null or undefined.

     

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.