[英]How do I remove the menuArrow in a Select widget in gwt-bootstrap3?
I have been trying to conditionally remove the menu arrow at the end of a Select box in my current project which uses gwt-bootstrap3. 我一直试图有条件地删除当前使用gwt-bootstrap3的项目中“选择”框末尾的菜单箭头。
I have tried the following options: 我尝试了以下选项:
<select:Select ui:field="fieldName" name="fieldName" b:id="fieldName" showMenuArrow="false">
<select:Option ui:field="option1" text="option1Text"/>
</select:Select>
I have also tried via the api, using 我也尝试通过api使用
fieldName.setShowMenuArrow(false);
I am mainly looking to disable this menu arrow when I would like to indicate that this selector is disabled and that options are not available for select dropdown. 我主要是想禁用此菜单箭头,以表示该选择器已禁用,并且选项下拉菜单不可用。
On inspecting element via the browser:I noticed that within the div for the select box there are other divs/spans and one nested as a child of the main selector div specifically with the 通过浏览器检查元素时:我注意到,在选择框的div中,还有其他div / span,其中一个嵌套为主要选择器div的子元素,尤其是
<span class="caret"></span>
On removing this class name I could make the menuArrow disappear. 删除此类名称后,我可以使menuArrow消失。 However accessing the specific span tag with this caret class using a querySelector and then making sure this is the right one (from the entire page which has other such selectors too) seems a slight challenge and unwieldy.
但是,使用querySelector使用此插入符号类访问特定的span标记,然后确保它是正确的标记(从整个页面中也具有其他这样的选择器)似乎是一个小挑战和笨拙。 Here's a snippet from the inspectElement on chrome.
这是chrome上的inspectElement的片段。 inspecting the Select element and the span with caret
使用插入符号检查Select元素和跨度
This seems like a bug in the menuArrow handling for the Selector and if it is indeed one, can anyone suggest a workaround until fixed?. 这似乎是选择器的菜单箭头处理中的一个错误,如果确实是一个错误,那么有人可以提出解决方法,直到修复为止。 Appreciate your suggestions/answers.
欣赏您的建议/答案。 Thanks!
谢谢!
The setShowMenuArrow
method is for something else: it turns on/off this arrow: setShowMenuArrow
方法用于其他setShowMenuArrow
:它打开/关闭此箭头:
If you want to hide caret on all disabled Select boxes you could try with css: 如果要在所有禁用的选择框上隐藏插入符号,可以尝试使用CSS:
.bootstrap-select.disabled .caret {
display: none;
}
If you want to hide it only some of them, first add new class name, for example no-caret-on-disabled
and use this: 如果您只想隐藏其中的一部分,请首先添加新的类名,例如
no-caret-on-disabled
并使用此名称:
.bootstrap-select.disabled.no-caret-on-disabled .caret {
display: none;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.