Sunday, 9 January 2011

Beginners Guide to QlikView Extension Objects : Part 3

So, we have created custom extensions that display data from QlikView.  However, we need to make that object respond to clicks and make selections back in the QlikView document.

This is achieved using the SelectRow function of the Data object.  When we write out our data, we need to make sure that we keep track of what row that data came from so that we can execute an “onclick” function to call SelectRow with that row number.  QlikView will then make that selection and refresh the data.

Here is the adjusted code to handle this:

Qva.AddExtension('CVL/BasicTable', function() {

        // Create a variable to hold generated html
        var html = "<table>";
        // Local variable to hold the reference to QlikView
        var _this = this;

        // function to handle users clicking on a row
    window.oncvlrowclick = function(rowIx)
    {
        _this.Data.SelectRow(rowIx);
    }

        // Cycle Through the data
          for (var i = 0; i < this.Data.Rows.length; i++) {
                // get the row
        var row = this.Data.Rows [i];

                // Generate html
                html += "<tr><td onclick='oncvlrowclick("+i+")'>" + row[0].text + "</td><td onclick='oncvlrowclick("+i+")'>" + row[1].text + "</td></tr>";
    }

        // Finalise the html
        html += "</table>";

        // Set the HTML
    this.Element.innerHTML = html;

},true);

OK, that is it.  Time for you to take over and start creating your own objects.  You now have the tools to create an object, populate it with QlikView data, and make it respond to clicks.

Enjoy.

14 comments:

  1. Great beginner tutorial, thanks!

    ReplyDelete
  2. Excellent series Stephen! Thanks for posting it.

    ReplyDelete
  3. Nice article. I am trying to integrate an extension into desktop. I chose flexigrid just to get started. I clicked on it and desktop opened and gave a message that it had installed the extension. However, I don't find it in the new sheet objects list? Please advise.

    ReplyDelete
  4. Nice work!!. If there are a lot of rows, is possible to show a vertical scrollbar?

    ReplyDelete
  5. Great tutorial!

    How could the onclick call be altered to pass a more granular value?
    For instance, pass the Category, SubCategory, ProductLine, Model, etc... as filter values by clicking on them in the extension object.

    ReplyDelete
  6. Excellent Stephen! Thanks for posting it.

    ReplyDelete
  7. I need an exension for integrate some .Net or Java component (GridView, CommandButton and Label) in a QlikView Extension to use in a QVW File. I tried from .Net with a QlikView Extension Project in Visual Studio 2010 and with a Label made in a JAR Applet in Java but not working. Can somebody helpme?

    ReplyDelete
  8. Hi Friends

    I did my project of creating a Java extension JAR, then create the script.js with some HTML to invoke the JAR and basic Definitions.XML, I think my problem is in the direction I have in the line someone applet HTML could help to correct it? try to use the example that one finds in QlikCommunity but neither called TreeView. The following are the line parameters Applet in HTML, the BlogSpot did not accept the line in HTML format

    code="grillaapplet.appletGriilla.class"
    archive="GrillaApplet.jar"
    width=400
    height=400

    ReplyDelete
  9. Again, thanks for this tutorial. All the parts of it!

    ReplyDelete
  10. Hi Stephen !! thanks for share your knowledge !!.
    I've been studying your guides, and know I have necessities.
    I found a javascript gridview class, I tried many ways and ufortunately without succes.
    Would you please give me a hand to include the js objets into extension.

    Thanks again.

    ReplyDelete