Hitachi Vantara Pentaho Community Forums
Results 1 to 10 of 10

Thread: How to make URL for records in CDE table component?

  1. #1

    Default How to make URL for records in CDE table component?

    Hi,

    I am creating new table component in my dashboard in CDE. I would like to add URL for every row I am reporting. It should look like this:

    ID Information Status Date
    123 abc New 01.01.2014
    124 xyz Closed 01.01.2013

    Is there a way, how to do it?

    I am able to do following:
    ID URL Information Status Date
    123 http://www.pentaho.com abc New 01.01.2014
    124 http://community.pentaho.org xyx Closed 01.01.2013

    I am a newbie, co please be patient .

    Thank you
    Magdalena

  2. #2

    Default

    I made a mistake and set this post to BI Platform instead of Community Tools - Ctools

  3. #3
    Join Date
    Dec 2010
    Posts
    304

    Default

    Hi Magdalena,

    try to put the following code in Draw Function of your table component:
    Code:
    function f() {
        var table = $('#' + this.htmlObject + ' table');
        var rows = $('tbody tr', table);
        var oTable = table.dataTable();
    
        rows.each(function(i) {
            var rowData = oTable.fnGetData(this);
            $("td:eq(0)", this).html("<a href='http://" + rowData[1] + "'>" + rowData[0] + "</a>");   
        });
    
        oTable.fnSetColumnVis(1, false);
    }

  4. #4

    Default

    Hi lukolap,

    thank you very much. It works perfectly.

    Magdalena

  5. #5
    Join Date
    Feb 2013
    Posts
    530

    Default

    function f() {
    var table = $('#'+ this.htmlObject + 'table');
    var rows = $('tbody tr', table);
    var oTable = table.dataTable();

    rows.each(function(i) {
    var rowData = oTable.fnGetData(this);
    $("td:eq(0)", this).html("<a href='http://www.google.com'" + rowData[1] + "'>" + rowData[0] + "</a>");
    });

    oTable.fnSetColumnVis(1, false);
    }

    The above code has not worked for me...

    I have given 0.1,2,3,4,5,6 indexes for query.. given 1st column type as hyperlink and in the draw function of table component written above code which is not taking me to google.com page...

    What could be the mistake I am doing here ?

    Thank you.
    Last edited by sadakar; 07-02-2014 at 02:56 AM.

  6. #6
    Join Date
    Dec 2010
    Posts
    304

    Default

    Hi sadakar,
    try with this...

    function f() {
    var table = $('#'+ this.htmlObject + ' table');
    var rows = $('tbody tr', table);
    var oTable = table.dataTable();

    rows.each(function(i) {
    var rowData = oTable.fnGetData(this);
    $("td:eq(0)", this).html("<a href='http://www.google.com" + rowData[1] + "'>" + rowData[0] + "</a>");
    });

    oTable.fnSetColumnVis(1, false);
    }

  7. #7
    Join Date
    Feb 2013
    Posts
    530

    Default

    though It's not working ..

    It's showing that the table component processing Error...

    My data in table component is :

    Name:  issue.png
Views: 646
Size:  24.9 KB

    I'm attempting hyperlink on 1st column i.e., Full Name column ..

    The Draw function code is already having <a href > </a> tag . So do I need to set column type as hyperlink again ? ( Of course checked by giving type as hyperlink as well with out it - none of the ways worked for me ).(Also, the Draw function code is taking indexes I have given result set 0,1,2,3 for the 4 columns.

    What I need to perform actually is : As soon as I click on "Full Name" field value , I have to navigate to other dashboard by passing the "full name" in a parameter (which will become input to the next dashboard)..

    i.e., it's a kind of detailed dashboard for that particular person.

    Thank you.
    Sadakar

  8. #8
    Join Date
    Nov 2009
    Posts
    688

    Default

    Place in the clickAction of the Table Component a script like

    function testClick(e) {
    var id = e.tableData[e.rowIdx][0];
    window.location = '/pentaho/content/pentaho-cdf-dd/Render?solution=XXX&path=XXX&file=XXX.wcdf&ParameterFullName=' +id;
    }

  9. #9
    Join Date
    Feb 2013
    Posts
    530

    Default

    Thank you.

    It's working as expected..!!!

    :-)

  10. #10
    Join Date
    May 2016
    Posts
    7

    Default

    Hi,

    I applied code:

    rfc.tableHyperlink = function h() {
    var table = $('#' + this.htmlObject + ' table');
    var rows = $('tbody tr', table);
    var oTable = table.dataTable();


    rows.each(function(i) {
    var rowData = oTable.fnGetData(this);
    $("td:eq(3)", this).html("<a href='" + rowData[13] + "'>" + rowData[3] + "</a>");
    });

    oTable.fnSetColumnVis(13, false);
    };

    in the "Post execution" in my table component. (Because it is not working when i put it in "Draw Function"). It works in the first page of the table component. But on second page and third page, it doesn't work.

    Can anyone help me with this?

    Thank you!!
    Last edited by woaisajiao; 06-01-2016 at 05:37 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.