lundi 9 mai 2016

Call function after highchart is loaded Ember.js

Can somebodu help with this challenge for me? I need to set up all boxes on the same height. I done that but the problem is with highcharts. It is loading after my function and when all it`s loaded in the boxes I have just half chart. Does somebody know how to call a function after the highcharts?

Thank you

import Ember from 'ember';

export default Ember.Component.extend({ /** * Equal heights of each box wrapper */ sameHeight: Ember.run.schedule('afterRender', function () {

    let boxes = document.getElementsByClassName("box");
    var tallest = 0;

    // Loop over matching and finding tallest
    for (let i = 0; i < boxes.length; i++) {
        let elementHeight = boxes[i].offsetHeight; //Get the height and width of a element, including padding and border
        if (elementHeight > tallest) {
            tallest = elementHeight;
        }
    }
    //add same height to all
    var findClass = document.getElementsByClassName('box');
    for (let i = 0; i < findClass.length; i++) {
        findClass[i].style.height = tallest + "px";
    }
})

});

This is a function in Ember Component.




Aucun commentaire:

Enregistrer un commentaire