Inside bind, "this" will not refer to ape, but the div itself. Try "console.log(this)" inside and out of the bind part to see the difference.
Envoyé de mon iPad > Le 2014-06-29 à 19:37, BM <[email protected]> a écrit : > > Hello, In my chat I am trying to set multiple chat containers per channel. > Everything is working fine right now: when using the following code in the > createPipe function: > > createPipe: function(pipe, options) { > var duplicates = $('#'+chanPubId); // if the channel already > exists > var chanPubId = pipe.getPubid(); // channel id of channel being > created > if (!duplicates.length) { > > $('div#CBTab.'+chanPubId).bind('click', {pipe: pipe, > options:options}, function(event) { > var data = event.data; > myPipe = data.pipe; > chanPubId = myPipe.getPubid(); > this.setCurrentPipe(chanPubId); > > }); > $('.chatBoxmsginCon').hide(); > $('div#'+chanPubId+'.chatBoxmsginCon').show(); > $('.showUsersToggleFrame').hide(); > } > > //Hide other pipe and show this one > MyPubId = pipe.ape.user.pubid; > this.setCurrentPipe(pipe.getPubid()); > }, > > > > I am trying to set the currentPipe to the channel id that is contained within > the tab the is binded on click. The problem is when i call > this.setCurrentPipe(chanPubId); inside the onclick function it is saying that > the currentpipe function is undefined and is not a function even though it > works perfectly at the end of the createPipe function. It seems as if the > myPipe is not updating the current pipe even though it is selecting the > correct channels and hiding and showing the one being clicked. It has the > correct pipe selected but I have no way to update it, as it just keeps > sending messages to the div being hidden instead of the new one that is being > shown. I hope i explained it enough. Thanks for any help. > > > -- > -- > You received this message because you are subscribed to the Google > Groups "APE Project" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/ape-project?hl=en > --- > APE Project (Ajax Push Engine) > Official website : http://www.ape-project.org/ > Git Hub : http://github.com/APE-Project/ > > --- > You received this message because you are subscribed to the Google Groups > "APE Project" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. -- -- You received this message because you are subscribed to the Google Groups "APE Project" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/ape-project?hl=en --- APE Project (Ajax Push Engine) Official website : http://www.ape-project.org/ Git Hub : http://github.com/APE-Project/ --- You received this message because you are subscribed to the Google Groups "APE Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
