简体   繁体   English

rich:autocomplete会截断要显示的选定文本

[英]rich:autocomplete truncates selected text for display

I have a rich:autocomplete dropdown selector in my application. 我的应用程序中有一个rich:autocomplete下拉选择器。 In the dropdown list that appears as the user begins entering text, the strings that have been loaded into the list of selections will happily display out to the entire width of the dropdown. 在用户开始输入文本时出现的下拉列表中,已加载到选择列表中的字符串将很高兴地显示到下拉列表的整个宽度。 However, once you make a selection only about 34 characters of the string will be displayed, with the result that the end user has to scroll left and right in the input box to see the entire string, see here (StackOverflow won't allow me to post inline images yet): http://imgur.com/Y9LLaBi 但是,一旦选择,将仅显示该字符串的大约34个字符,结果最终用户必须在输入框中向左和向右滚动才能看到整个字符串,请参见此处(StackOverflow不允许我尚未发布嵌入式图片): http : //imgur.com/Y9LLaBi

Here's the offending table cell in the frontend XHTML file. 这是前端XHTML文件中令人讨厌的表格单元。 It uses the JSF and richfaces namespaces and there's a backing bean that creates the autocomplete suggestion list and executes other business logic, but I believe this is the only relevant code: 它使用JSF和richfaces命名空间,并且有一个支持bean创建自动完成建议列表并执行其他业务逻辑,但是我相信这是唯一相关的代码:

<td height="20" class="addborderright addborderbottom inputbox" colspan="4">&nbsp;
    <!-- nb: richfaces autocomplete to ensure proper name entry -->
    <h:message styleClass="errormsg" for="campusName" />
    <rich:autocomplete id="campusName" length="50" mode="client" minChars="1"
        layout="table" autofill="true" selectFirst="true" 
        onselectitem="javascript:executeAction( 
        '#studentComplaintCampusInformationBean.formName}',
        'populateCampusAddressFieldsLink');" 
        value="#{studentComplaintCampusInformationBean.campus.operatingName}"
        autocompleteList="#{studentComplaintCampusInformationBean.registeredCampusNameList}" 
        style="width:370px" fetchValue="#{fn}" var="fn" maxlength="100">
            <rich:column>#{fn}</rich:column>
    </rich:autocomplete>
</td>

To make the dropdown box left-justify text and be the same as the width of the input field the following CSS is at the top of the XHTML file: 为了使下拉框文本左对齐,并与输入字段的宽度相同,以下CSS位于XHTML文件的顶部:

<style>
.rf-au-fnt{
    text-align: left; float: left;
}
.rf-au-lst-dcrtn .rf-au-lst-scrl {
    width: 370px; !important
}
</style>

However, there doesn't appear to be a CSS property relating to the width of the displayed text in the input box, so it appears cut off to the end user, and only fills about half the available space in the input box! 但是,在输入框中似乎没有与所显示文本的宽度相关的CSS属性,因此它对于最终用户而言似乎是截断的,仅填充了输入框中大约一半的可用空间! Could someone please help? 有人可以帮忙吗? Thanks! 谢谢!

rf-au-fnt is the class of the input, you're already overriding it so just add the width. rf-au-fnt是输入的类,您已经覆盖了它,因此只需添加宽度即可。

As a sidenote, rather than directly overriding the RichFaces classes you should set a class for the component and then write stylesheets like 作为旁注,而不是直接覆盖RichFaces类,您应该为组件设置一个类,然后编写样式表,例如

.myAutocomplete .rf-au-fnt {text-align: left; float: left; width: 370px !important
}

This way you don't change something you wouldn't want to. 这样,您就不会更改您不想更改的内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM