Reputation: 3524
Nice use case for edit fields with type ahead allows to click into empty field or to use alt+down shortcut, and list of recent/default values is provided. User does not need to guess what letter to type and has useful list of choices to start with.
Question: how can I invoke field's typeAhead partial refresh event when user enters/clicks to empty field, or uses alt+down? I expect submited variable defined by "var" property will be empty, I will handle it in code to get proper choices.
<xp:inputText
id="inputTextLookup"
styleClass="lotusText"
value="#{viewScope.znalostiLookup}">
<xp:typeAhead
mode="partial"
minChars="1"
var="valueToLookup"
ignoreCase="true"
preventFiltering="true"
valueMarkup="true"
maxValues="10">
<xp:this.valueList><![CDATA[#{javascript:return options(valueToLookup);}]]></xp:this.valueList>
</xp:typeAhead>
</xp:inputText>
Upvotes: 0
Views: 217
Reputation: 10485
You can do this f.e. by using the onFocus event of the inputText field.
<xp:eventHandler
event="onfocus"
submit="false">
<xp:this.script>
<![CDATA[
var typeAhead = dijit.byId('#{id:inputTextLookup}');
typeAhead._startSearch("ONFOCUS");
]]>
</xp:this.script>
</xp:eventHandler>
The parameter of the _startSearch() method is the value send to the server.
Upvotes: 3