Primefaces自动完成-单击输入时如何显示下拉项 [英] Primefaces Autocomplete - How to display dropdown items on click of input

查看:57
本文介绍了Primefaces自动完成-单击输入时如何显示下拉项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用PF 4/5和Mojarra 2.2

Using PF 4/5 and Mojarra 2.2

我有一个自动完成字段,其中显示了一个下拉列表.当我单击下拉列表或开始输入输入内容时,将显示项目列表.我希望在输入框获得焦点时显示项目列表,以便从本质上讲我可以删除下拉按钮图像.我不确定如何触发.

I have an autocomplete field with a dropdown being shown. The list of items displays when I click the dropdown or start typing in the input. I want the list of items to display when the input box gets focus so that essentially I can remove the dropdown button image. Im not sure how to trigger that.

<p:autoComplete minQueryLength="0" size="7" queryDelay="0" dropdown="true" scrollHeight="200" value="#{scheduleView.startTime}" id="startTime"  completeMethod="#{scheduleView.getTimes}" required="true" onclick="this.select()">

推荐答案

您可以在自动完成输入单击时触发客户端的search()函数:

You can trigger client side's search() function on autocomplete input click :

<p:autoComplete
    id="startTime"
    widgetVar="foo"
    value="#{scheduleView.startTime}"
    completeMethod="#{scheduleView.getTimes}"
    required="true"
    dropdown="true"
    size="7"
    scrollHeight="200"
    minQueryLength="0"
    queryDelay="0"
    onclick="PF('foo').search(PF('foo').input.val());">

这篇关于Primefaces自动完成-单击输入时如何显示下拉项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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