Skip to main content
1-Visitor
May 24, 2019
Solved

Click event in list widget activates hyperlink

  • May 24, 2019
  • 1 reply
  • 1683 views

Hello,

I'm trying to create a dynamic list. So that when an item in the list is clicked on, it sends me to another experience (i.e. activate a hyperlink) 


I'm currently populating the list with a JSON list and utilizing the "return JSON.parse(value)" function, and the list displays the Name column.
[{"Experience":"URL1","Name":"Name1"},{"Experience":"URL2","Name":"Name2"},{"Experience":"URL3","Name":"Name3"},{"Experience":"URL4","Name":"Name4"}]

 

So the question is, how do you go about utilizing the "Item click" event within the list widget to activate a hyperlink based on which item was clicked?

 

 

Best answer by tmccombie

You can do this without the use of the hyperlink widget. Add this function to your Home.js file and then call it on the 'Item Click' event of the list widget.

 

$scope.openExperience = function(){
 
 var list = $scope.app.view['Home'].wdg['list-1']['list'];
 var selection = $scope.app.view['Home'].wdg['list-1'].list.selectedRows;
 
 for(i=0; i<list.length; i++)
 {
 if(list[i].Experience == selection[0].Experience)
 {
 window.location = list[i].Experience;
 }
 }
}

1 reply

tmccombie21-Topaz IAnswer
21-Topaz I
June 4, 2019

You can do this without the use of the hyperlink widget. Add this function to your Home.js file and then call it on the 'Item Click' event of the list widget.

 

$scope.openExperience = function(){
 
 var list = $scope.app.view['Home'].wdg['list-1']['list'];
 var selection = $scope.app.view['Home'].wdg['list-1'].list.selectedRows;
 
 for(i=0; i<list.length; i++)
 {
 if(list[i].Experience == selection[0].Experience)
 {
 window.location = list[i].Experience;
 }
 }
}