You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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:
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.
The text was updated successfully, but these errors were encountered: