出现在< p:autoComplete上方的Primefaces自动完成行 [英] Primefaces autocomplete rows appearing above <p:autoComplete

查看:189
本文介绍了出现在< p:autoComplete上方的Primefaces自动完成行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有素数autocomplete,它从数据库中获取值. 当我输入字符时,我可以看到autocomplete中的行有时出现在上方 <p:autoComplete,通常应显示在<p:autoComplete下面.

I have primefaces autocomplete which is fetching values from database. When I type in characters, I could see rows in autocomplete are sometimes appearing above <p:autoComplete, it should appear normally below <p:autoComplete.

请参阅以下屏幕截图以供参考.我该如何解决这个问题?

See below screenshot for reference. How can I resolve this issue?

Primefaces 3.1版

Primesfaces version 3.1

JSF代码

<p:autoComplete value="#{bean.selectedEmployees}"  
 completeMethod="#{bean.employeeList}"  
        var="vs" itemLabel="#{vs.empName}" itemValue="#{vs.empName}"  multiple="true"> 

        <p:column style="width:100%;text-align:center">  
            #{vs.empName} - #{vs.empNumber}  
        </p:column>  
    </p:autoComplete> 

致谢

更新1

ManagedBean

ManagedBean

public List<Schedules> employeeList(String query) {

for(Schedules vs : employees) {  
                if(vs.getEmpName().toLowerCase().startsWith(query.toLowerCase()))  
                    suggestions.add(vs);    
            }
return suggestions;

并在构造函数中

employees = MyDAO.loadEmployees();

推荐答案

我遇到了同样的问题.我相信原因是当您有一个很大的建议列表时,primefaces会发现如果将其向下显示,它就无法容纳在浏览器边界内,因此,它只是盲目地向上拉下拉列表. (这可能会使情况更糟),尽管我听说scrollHeight也有其自身的问题,但请尝试添加scrollHeight来限制下拉列表的长度

I had the same problem. I believe the reason is when you have a large suggestion list, primefaces sees it can't fit within the browser boundary if it was displayed downwards, so it just blindly flip the dropdown upwards. (which possibly makes it worse) Try add scrollHeight to limit the dropdown length although I heard scrollHeight also has its own problem

这篇关于出现在&lt; p:autoComplete上方的Primefaces自动完成行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆