Articles in this section

Bind Custom Events to ListView Component

In ListView component, we have multiple events like actionBegin, actionComplete, actionFailure and select to interact with ListView.

We can interact with ListView items using select event which will be get triggers while we are selecting a list item. As like ListView select event, we can bind custom events like double click to interact with the list items.

Here we bind the doubleclick event to the parent element of the list items with the help of addEventListener method in actionComplete event of ListView Component. In the double click event we have displayed the selected item text.

Refer to the below code snippet to bind custom events in ListView.

    function onActionComplete() {

  listObj.element.getElementsByClassName('e-content')[0].addEventListener("dblclick", onDoubleClick.bind(this));

  } 

     function onDoubleClick(args) {

        var selectedItem = listObj.getSelectedItems();

        document.getElementById('val').innerHTML = 'You have clicked <b>'+selectedItem.text+'</b> twice';

    }

 

 

Refer to the below sample link.

Sample

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Access denied
Access denied