UiBinder小部件中的自定义属性 [英] Custom attributes in UiBinder widgets
问题描述
我为我的应用使用了GWT和UiBinder,并且我正在尝试这样做。
但是自定义<$ c $ c> placeholder 返回到java代码中。关于如何在UiBinder本身做到这一点的想法?我想我可以将它改为正常的输入元素,并尝试获取参考及其价值,但我宁愿不走那条路。 如何创建自定义< g:TextBox ui:
属性不起作用,因为
TextBox $ c $上没有
with method setPlaceholder
方法c> - 我需要这个:
$ b searchBox.getElement()。setAttribute(placeholder,search);
SearchBox
> TextBox setPlaceholder(String placeholder)
?
< custom:SearchBox ui:field =searchBoxstyleName ={style.searchBox}
placeholder =search/>
I'm using GWT and UiBinder for my app, and I'm trying to do this
<g:TextBox ui:field="searchBox" styleName="{style.searchBox}" placeholder="search" />
But the custom placeholder
attribute won't work because there isn't a setPlaceholder
method on TextBox
- I need to this:
searchBox.getElement().setAttribute("placeholder", "search");
back in the java code. Any ideas on how to do this in UiBinder itself? I suppose I could change it over to a normal input element and try to grab a reference and its value, but I'd rather not go down that road.
What about creating custom SearchBox
that extends TextBox
with method setPlaceholder(String placeholder)
?
Then in UiBinder:
<custom:SearchBox ui:field="searchBox" styleName="{style.searchBox}" placeholder="search" />
这篇关于UiBinder小部件中的自定义属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!