Another problem I noticed when trying to adapt a TW1 app to TW2:
When a widgets uses a JSLink as a resource, then this JSLink will only
be injected once on the same page, however, when it uses a JSSource as a
resource, then this JSSource will be injected as many times as the
widgets appears on the page.
Here is a typical use case that demonstrates the problem:
import tw2.core as twc, tw2.forms as twf
import tw2.devtools as twd
class MyField(twf.TextField):
resources = [twc.JSLink(link='some_plugin'),
twc.JSSource(src="$('.myfield').init_plugin()")]
css_class = 'myfield'
class Index(twf.FormPage):
title = "Test"
class child(twf.TableForm):
field1 = MyField()
field2 = MyField()
twd.dev_server()
When you run this code, you will see that the plugin link is only
injected once in the head of the page, but the initialization code is
inserted twice at the bottom of the page, which is usually not what you
want, and different from the behavior of TW1.
Is this a bug, or am I doing something wrong here?
-- Christoph
--
You received this message because you are subscribed to the Google Groups
"ToscaWidgets-discuss" 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/toscawidgets-discuss?hl=en.