onItemClicked event

Wix Code Forum,

I am using a Pro Gallery connected to a dataset to populate image, title, description and link… It works great and have added some code to filter and sort the dataset interactively, etc… But I want to capture the item click using the onItemClicked event and it is not firing… I have setup an event handler through the property page with a simple Console.Log message and it never fires… Other event do fire, but not onItemClicked event for some reason… This is critical to complete my design, since it is the click event I need to take a custom action on the item… Note that I am aware of the Gallery Setting of “Open in Expand”, “A link opens” and “Nothing Happens”… I tried all the settings to see if effects the event issue, it doesn’t… And I need a different action in that of what is natively provided by these options… Any thoughts?

Thanks,
Marc

Hi Marc,
Can you please share with us the code you were trying to use? Moreover, can you please send us the site URL?

Thanks,
Tal.

Hey Tal,

Sure… The site URL https://www.psysopstudio.com/ and specific page URL is https://www.psysopstudio.com/music… I want a my listeners to explore my music a bit more… Thus, the filtering and sorting functions… They can then choose the single, which corresponds to a single page…

I actually got it working with this code as follows :

//$w.onReady(function () {
// // Create dynamic event handler for music gallery click
// $w(“#musicGallery”).onItemClicked(async (event, $w) => {
// // Call function to process click
// musicGallery_clicked(event);
// } );
//});

I commented it out so you can see what is not working, which is the following :

export function musicGallery_itemClicked(event, $w) {
// Call function to process click
musicGallery_clicked(event);
}

This is of course is wired up through the properties panel in the onItemClicked event… But I have not been able to get this event to fire for some reason… Note that Pro Gallery is binded to a dataset with all the song data stored, retrieved and populated through the Pro Gallery…