Jquery $(window).load() equivalent in Meteor?


#1

I’m stretching a data table vertically to fill the contents of a page using jquery. This works correctly in the following method. The resize event gets triggered and everything works.
The following method is inside my onRendered() method and works correctly when I resize the window…all good. I can’t seem to get on load/document ready or whatever the actual Meteor event is to call the same method on initial load (without having to resize the window).

$(window).resize(function() {
        stretchTableHeight();
    });

method I"m calling:

function stretchTableHeight(){
        console.log("called stretchtableheight");
        var vph = $('.env-parent').height();
        var rh = $('#reportHeader').height();
        var tab = $('.env-org-settings-nav').height();
        var sticky = $('.sticky-header').height();
        var caption = $('.env-uci-caption').height();
        var thread = $('.env-uci-thead').height();
        var totalExtrasHeight = rh+tab+sticky+caption+thread;
        var newTableBodyHeight = vph - totalExtrasHeight - 70;
        $('.env-table-body').css({'height': newTableBodyHeight + 'px'});
    }

However, I’d like to call “stretchTableHeight()” on document ready or whatever Meteor’s on ready event is.
I’ve tried everything I can think of , but it never calls the method on initial load".
I’ve tried:

$(window).load(function() {
        stretchTableHeight();
    });
 $(document).ready(function(){
     stretchTableHeight();
});

stretchTableHeight(); at the bottom of onRendered method.

How do I call the strethTableHeight when everything is “ready”?


#2

It turns out that the issue wasn’t based on an event. The objects weren’t in the view and thus no heights could be calculated, etc. I tried to find a place to delete the post, but couldn’t find it…