Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X
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?
Solved! Go to Solution.
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;
}
}
}
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;
}
}
}
