I am doing an app where I have a map where are markers with locations of people stored in LocalStorage. I want to open a panel expanding user's description when "Details" button of marker's InfoWindow is clicked.
My problem is when I click "Details". The panel opens, but "Name" and "Description" shows always info of last person instead of person selected.
I'm convinced that I need to add something in eventAddListener of putPeopleInMap function, but I'm not sure how to do it.
MODEL:
TPeople: Object{Name:String, Lat:String, Long:String, Description:String}
TPeopleList: Array(TPeople)
STORAGE:
PeopleList: TPeopleList
PersonSelected: TPeople
ADD MARKERS FUNCTION (edited to add image better than text):
e.g. I have PeopleList with this values:{[0]: {Name: Peter Pan, Lat: 55, Long: 40, Description: Hello, I'm Peter}, [1]: {Name:James Water, Lat: 88, Long: 52, Description: Hello, I'm James}, [2] {Name:John Cobra, Lat: 48, Long: 412, Description: Hello, I'm John}}. If I push in button of markers 0 and 1 (correctly positioned on the map) info shown is of 2.
How can I open the panel with correct information?