addTarget (target)
target. JSON object that contains autocomplete parameters for specified control. The following parameters are defined:
Control. Control to be added to the autocomplete system. An instance of PP.Ui.Control.
Active. Determines if a list of suggestions is displayed: true – the list is displayed, false – is not. By default the property is set to false. AlwaysShow parameter must be set to true;
MatchCase. Determines if the text is case-sensitive: true - case-sensitive, false – the case is ignored. By default the parameter is set to false.
Suggestions. Determines an array of autocomplete suggestions for a specified control.
AlwaysShow. Determines if a list of suggestions is displayed: true – the list is displayed, false – is not. By default the property is set to false. Active parameter must be set to true.
The addTarget method adds a control to autocomplete system.
To execute the example, the page must contain Autocomplete component named autocomplete (seep; Autocomplete constructor). In the BODY tag add a DIV item with the example2 identifier. Add the TextBox component to autocomplete system:
autocomplete.addTarget({
//input box
Control: number = new PP.Ui.TextBox({
ParentNode: document.getElementById("example2"),
Width: 100,
Id: "tb"
}),
AlwaysShow: true,
MinAutoFindSymbolsCount: 2,
Active: true,
//not case sensitive
MatchCase: false,
//suggestions for autocomplete
Suggestions:
[
{
Text: "Austria"
},
{
Text: "Australia"
},
{
Text: "Andorra"
}
]
}
)
After executing the example TextBox component is added to the page, autocomplete option is enabled for this component.
See also: