Autocomplete.Selected

Syntax

Selected: function (sender, args)

Parameters

sender. Event source.

args. Information on the event, an instance of the class PP.AutocompleteEventArgs. Available argument: SelectionIndex  - index of the selected tooltip.

Description

The Selected event occurs after selecting a suggestion from the menu.

Example

To execute the example, the page must contain Autocomplete component named autocomplete (seep; Autocomplete constructor). Add the DIV element with the Div1 identifier in the BODY tag. The autocomplete system must include a control with the identifier TB1. Add a button clicking which shows the list of suggestions for the component with the TB1 identifier, and a handler for the Selected event:

//Add a button clicking on which shows the list of suggestions for the component with the TB1 identifier:
var but1 = new PP.Ui.Button(
{
    ParentNode: document.getElementById("Div1"),
    Click: function ()
    {
        autocomplete.showSuggestion("TB1")
    },
    Content: "Show"
});
//On selecting the menu item with tooltips the Item (index of selected tooltip) is selected message is displayed
autocomplete.Selected.add(function (sender, args)
{
    alert("Item " + args.SelectionIndex + " is selected")
});
//On menu opening, the browser console displays an instance of the following class: PP.AutocompleteEventArgs
autocomplete.Opened.add(function (sender, args)
{
    console.log(args)
});

After executing the example clicking the Show button shows a menu that contains all suggestions set for the control with the TB1 identifier. On opening the menu the browser console shows an instance of the PP.AutocompleteEventArgs class. Select one of the options, and the screen will show the following message: Item (index of selected suggestion) is selected.

See also:

Autocomplete