Hi, I am trying to define the following component, which uses native javascript:
class MyTaggingComponent(HTML): def __init__(self, myid, values, width = 300): self.myid = myid values = ','.join(values) html = '<p><input type="hidden" id="%s" style="width:%dpx" value="%s"/></p>' % (myid, width, values) HTML.__init__ (self, html) def final_setup(self, selected = '"red", "green", "blue"'): my_javascript = 'parent.jQuery("#%s").select2({tags:[%s]});' % (self .myid, self.selected) JS(my_javascript) I get a compile error: "JS function only supports constant strings". This is a big problem, since, in order to reuse this component, I need to have variable content in the inline javascript. I have taken a look at the implementation of JS in pyjs/pyjs/src/pyjs/translator_proto.py, but it is not clear for me whether bypassing this restriction is possible, or how could it be done. Could you suggest a workaround? Thanks, Daniel