Creating an interactive extension

This recipe follows on from the previous one to show how we add interactivity to our QlikView.

Getting ready

Create the extension from the Creating a simple HTML table recipe.

How to do it…

Follow these steps to create an interactive extension:

  1. Edit the Script.js file. Modify the rowstring value like this:
    var rowstring = "<tr><td class='myTable' onClick='onmyrowclick({2});'>{0}</td><td class='myTableR'>{1}</td></tr>";
  2. Just below this line, add this new code block:
    // Register a function to handle the click
    window.onmyrowclick = function(irow)
    {
       _this.Data.SelectRow(irow);
    }
  3. Finally, modify the line that builds the HTML (under the // Generate HTML comment):
    html += rowstring.format(row[0].text, addCommas(row[1].text), i); ...

Get QlikView for Developers Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.