Search results

How to ListView with hyper-link navigation

We can use anchor tag along with href attribute in our ListView template property for navigation.

let anchor_template: string = "<a target='_blank' href='${url}'>${name}</a>";

In the below sample, we have rendered ListView with search engines URL.

//Define an array of JSON data
var dataSource = [
    { name: 'Google', url: '' },
    { name: 'Bing', url: '' },
    { name: 'Yahoo', url: '' },
    { name: '', url: '' },
    { name: '', url: '' },
var anchor_template = "<a target='_blank' href='${url}'>${name}</a>";

// Initialize ListView component
var listObj = new ej.lists.ListView({

    //Set defined data to dataSource property
    dataSource: dataSource,

    //Set header title
    headerTitle: 'Search engines',

    //Set true to show header title
    showHeader: true,

    template: anchor_template


//Render initialized ListView component
<!DOCTYPE html><html lang="en"><head>
    <title>Essential JS 2 for ListView </title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="Essential JS 2 for ListView UI Control">
    <meta name="author" content="Syncfusion">
    <link href="index.css" rel="stylesheet">
    <link href="//" rel="stylesheet">
    <link href="//" rel="stylesheet">
<script src="" type="text/javascript"></script>

    <div id="container">
        <div id="element"></div>

var ele = document.getElementById('container');
if(ele) { = "visible";
<script src="index.js" type="text/javascript"></script>