Here are some links that could help find the solution:

http://stackoverflow.com/questions/9245657/typeerror-unbound-method-method-name-must-be-called-with-class-name-instanc
http://api.jquery.com/bind/

The first one is ... aahh! ... a Python answer!! In the jQuery
documentation I read things like "$(this).foo" and binding always with
"function { ... }", which I would try literally. Also if "change =
wnd().change" the function could by - *guessing wildly* - be available
as "window.change"?

Sorry that I don't try to get your example working hands-on. I'm on
some other project in parallel that I need to get going... :-(

Peter


2012/7/10 Peter Bittner <peter.bitt...@gmx.net>:
> Daniel,
>
> 2012/7/10 Daniel Gonzalez <gonva...@gmail.com>:
> ...
>> myjs = 'parent.jQuery("#%s").bind("change", this.change);' % (self.myid)
>> Uncaught TypeError: unbound method change() must be called with
>> MySelect2TaggingComponent instance as first argument (got '[object Object]'
>> instead)
>>
>> myjs = 'parent.jQuery("#%s").bind("change", self["change"]);' % (self.myid)
>> Uncaught TypeError: unbound method change() must be called with
>> MySelect2TaggingComponent instance as first argument (got '[object Object]'
>> instead)
>>
>> myjs = 'parent.jQuery("#%s").bind("change", change);' % (self.myid)
>> jQuerySelect2 AttributeError: change is not defined
>
> Just a quick thought: have you tried running your example with pyjd
> instead of pyjs? If that works there may be a Python stack trace that
> helps much more than the "Uncaught TypeError:" error message that come
> from ... whom? Can you try?
>
> Peter
>
>
>> You can see the code (not yet working) in my fork:
>> https://github.com/gonvaled/pyjs/blob/master/examples/jquery-select2/jQuerySelect2.py#L45
>>
>> You can compile the jquery-select2 example like this: python jquery-select2
>> --download (in the examples directory). Output goes to examples/__output__
>>
>> Br,
>> Daniel
>>
>> On Saturday, July 7, 2012 9:56:36 PM UTC+2, istvan.vago wrote:
>>>
>>> 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

Reply via email to