Daniel, after you've got this working, a question: What is this "Logger" thing you're using?
There is a Pyjs logging module, and logging should be easy (and shorter) using it the following way: from pyjamas import logging log = logging.getConsoleLogger() # other loggers: Alert, Append, Print ... # ... log.error("Hello, here is an %s error", err_name) See the (not yet beautiful, but evolving) website for more explanations: http://pyjs.org/Developing.html Just my two cents / sorry for bugging you, Peter 2012/7/7 istvan.vago <istvan.v...@gmail.com> > Daniel, > try this: > > from __pyjamas__ import wnd > > class MySelect2TaggingComponent(HTML): > > def change(self): > ... > > > wnd().change=change > > The change method will be accessible from jQuery as "change". > > Istvan > > 2012. július 6., péntek 11:51:59 UTC+2 időpontban Daniel Gonzalez a > következőt írta: > >> Hi all, >> >> I am completing my integration of a jQuery component with pyjs, which I >> will share with you as soon as is ready. We could add that to the examples >> dir. >> >> Currently I am trying to pass a jQuery event up to my python code. The >> jQuery component is a Select2 element, which fires a change event whenever >> the user changes the content. I have verified that this is working by >> calling a pure javascript function, like this: >> >> class MySelect2TaggingComponent(**HTML): >> >> ... >> >> def setup_show(self): >> show = ''' >> function show() { >> var e=parent.jQuery("<div style='background-color:yellow* >> *;'>change fired</div>"); >> parent.jQuery("#%s").append(e)**; >> e.animate({opacity:0}, 100000, 'linear', function() { >> e.remove(); }); >> };''' % (self.myid) >> myjs = '%s parent.jQuery("#%s").bind("**change", show);' % (show, >> self.myid) >> Logger("**MySelect2TaggingComponent > setup_show", "Now calling >> JS: %s" % (myjs)) >> JS(""" eval(@{{myjs}}) """) >> >> As you can see here, what I am doing is to define a show function and >> bind it to the element change event. This works. >> >> Now instead of calling the javascript show function, I want to call a >> pyjs "change" function, which will perform data processing and will send >> the data to the server. >> >> I would like to define a change method like this: >> >> class MySelect2TaggingComponent(HTML**): >> >> >> def change(self): >> ... >> >> >> How can I bind the javascript "change" event to this change method? >> >> Thanks, >> Daniel >> >