OnClick event on List

Hi Team,

I am using the below code for onclick event on list

on:{
“onItemClick”:function(id){
console.log(id);
}
},

Below data is assigned for the List

var listData=[

			{"id":1,type:2,"name":"Dr. Clement Darling","location":"Koromangala","rank":"1"},
			{"id":2,type:2,"name":"Dr. Nitesh Chawla","location":"JayaNagar","rank":"2"},
			{"id":3,type:2,"name":"Dr. Paul Miller","location":"Marathalli","rank":"3"},
			{"id":4,type:2,"name":"Dr. James Cook","location":"White Field","rank":"4"}
			
];

The problem i am facing is i am able to get the clicked items “id” but i need to know how to get
other values of the same (like name, location, rank).

You can use getItem method to get the related data object

on:{ "onItemClick":function(id){  
    var item = this.getItem(id);
    alert(item.name);
}}

Hi Viktor,

Thank you , it helped alot.