reactjs - Jquery each loop $this pointer scope -
in jquery i'm stuck understanding this
scope inside each
loop. i'm not able access other function accessing inside each loop.
i'm getting error:
self.loadgraphchart not function" , "cannot read property 'location' of undefined
please let me know how can access other functions inside each loop.
loadgraphonscroll() { var self = this; $(".scrollposition").each(function() { var cluster = self.props.location.query.id; self.loadgraphchart('p1','p2'); } }); } loadgraphchart('p1','p2') { }
edit
actual code comments:
loadgraphonscroll() { $(".scrollposition").each(function() { var visible = $(this).visible('partial'); if(visible == true) { var getid = $(this).attr('id'); var id = this.props.location.query.id; var graphtype = jsondata.plots[getid].graphtype; this.loadgraphchart(id, graphtype); } }); }
Comments
Post a Comment