jeudi 9 juillet 2020

Ember invoke jQuery code only on initial render

In my Ember component class, I want to run some jQuery code to hide some elements. However, I want this code to run only on initial render and not on other events (say grid refresh)

hidePositionElements: function() {
    var self = this;
    var currPosLabelElements = $( ".my-grid-footer-value:contains('" + self.nls('current_position__label') + "')");
    currPosLabelElements.hide();
},

I tried adding to "didRender", but that runs multiple times.

The other thing I need to consider is the access to a property on my component instance from within this jQuery code i.e. self.nls('current_position__label')




Aucun commentaire:

Enregistrer un commentaire