Hitachi Vantara Pentaho Community Forums
Results 1 to 21 of 21

Thread: click action on table component?

  1. #1

    Default click action on table component?

    Is there a way to run an action when I click on a row from a table component, the same I can do when I click a sector of a pie chart?

    Thanks

  2. #2
    Join Date
    Mar 2011
    Posts
    257

    Default

    I used a different solution.
    By adding a href in the query and using the value in the table as a parameter for an other report.
    I don't know exactly what you want to do but this is a way to get a fast and easy solution ...

    grtz,
    Hans

  3. #3

    Default

    Thanks for the reply. I want that when the user clicks on a row, it refreshes another table with data associated to one of the fields of that row.

  4. #4
    Join Date
    Jul 2007
    Posts
    2,498

    Default

    Its possible with the drawCallback option, but we're going to make it simpler by exposing a clickAction event like the ccc charts have
    Pedro Alves
    Meet us on ##pentaho, a FreeNode irc channel

  5. #5

    Default

    I upgraded ctools and now see a click action on the table component. how can I get a row value on click?
    I tried a function(v){alert(v);}
    But I only get [object Object]

    Thanks

  6. #6

    Default

    Hi, first sorry for my english!!

    Anybody have an example that implements the click action in a ccc chart? and clic action in a table component?
    or tell me where to get it.

    regards,
    leticia

  7. #7
    mfiga Guest

    Default

    Hi jloffredo

    In Components # table Component # Click action

    You can show an object variable:
    function(a){
    alert(a.toSource());
    }

    After that, you can acces with:

    function(a){
    alert(a.series);
    }

  8. #8
    mfiga Guest

    Default

    Hi levi2805

    I've 2 example for you:

    For CCC Bar Chart - Click action:
    function (a,b){
    Dashboards.fireChange('Parameter_x',a);
    Dashboards.fireChange('Parameter_y',b);
    }

    For table Component - Click action:
    function(a){
    Dashboards.fireChange('Parameter_n',a.series);
    }

    See you,

    Marc

  9. #9

  10. #10
    Join Date
    Jul 2007
    Posts
    2,498

    Default

    Nice work man!
    Pedro Alves
    Meet us on ##pentaho, a FreeNode irc channel

  11. #11

    Default

    Thanks Pedro.Just sharing my example to help community explore the features of CTOOLS. All credit goes to webdetails who shared these great tools with communities.
    Keep your good work for benefits of everyone.

  12. #12

    Default

    Hi mfiga
    Thanks a lot for your example!!!
    Im traying the example.


    And bidev, thanks for your tutorial.

    Thanks a lot!!!

  13. #13
    Join Date
    Nov 2011
    Posts
    10

    Default

    hi levi2805, did you find solution of your question ? How to make table component clickable and set click action?
    For ccc bar chart I set it clickable true , and wrote on click action :
    function(s,c,v){
    Dashboards.fireChange('p_ab',c);
    }

    where
    p_ab is parameter and it works , but I can not do the same with table component , because there is no proerty to set table component clickable and write on click action.

  14. #14

    Default

    Hi goon,
    Unfortunately I could not find a solution to this.
    I searched and searched but no examples.

    let me know if you fuad it!!!

  15. #15

    Default

    goon i dont have a click action in table component.
    But i think whe have to upgade the ctools!!!

    Iam going to test that and tell you
    regards

    It works, if you update de ctools apears the clickaction propertie.
    Last edited by levi2805; 11-29-2011 at 04:58 PM.

  16. #16

    Default

    What you have to do is:
    Components->Generic->Simple parameter say add parameter and value both name test
    Components->Table->Click action->use the java script below.
    function testClick(test){
    alert(test.value);
    }
    This will make all the cell in the table component clickable and should alert with table value in dialog box.
    Let me know if this works for you.I will be happy to share source code but its straight forward.

  17. #17
    Join Date
    Apr 2011
    Posts
    159

    Default making it look like a hyper link

    after getting table to be clickable, to me, I think making it 'look' clickable (ie. look like a hyper link) is important

    i am confident there is a more elegant and concise way to do this, but this is way i knew how to do it, but the following snippet will make all elements in the 1st column underlined and blue:

    In post-execution:
    Code:
    function f(){
        var cols = $("#your_html_object td:nth-child(1)");  // gets the # of rows in your table
        var counter = 0;                                               // my counter to choose if i want to style the cell 
        $('#your_html_object tr').each(function() {           // jquery loop method for all table-rows
            counter++;                                                  // increment counter
            if (counter < cols.length+1){                          // remove the +1 if you do NOT want to style the last row, ie. you have a TOTAL 
                $('#your_html_object tr:eq('+counter+') td:eq(0)')  
                    .css({'color':'blue','text-decoration':'underline'});
            }
        });
    }
    Of note: one reason I worked on this counter-comparison method was I have a summary total at the bottom of my table that I did NOT want to look clickable, so I built the loop and changed my if statement to be if (count < cols.length), which shorted the loop 1x and left the last row alone.

  18. #18
    Join Date
    Mar 2011
    Posts
    257

    Default

    Wow, you could have used some css to change the font...

  19. #19
    Join Date
    Apr 2011
    Posts
    159

    Default

    Like i said, I am confident there is a more elegant and concise way to do this...perhaps someone, someday, will post that css-easier method

    ...though, technically, I am using css to change the font...

  20. #20
    Join Date
    Mar 2012
    Posts
    3

    Default click on table component

    hi guys, i follow your steps and make my table component as clickable, its work fine,
    and i want one more,
    such as while i clicking the cell in table component(particular value in cell) the concern data will occur on CCC Bar Chart.

    for eg. i click 'order_id' on table component (before i create a data source such as Select bpartner_id, sum(grandtotal) from table_name where order_id=${orderid} group by bpartner_id) the concern data will occur on CCC Bar chart..


    Advance thanks....

  21. #21
    Join Date
    Mar 2012
    Posts
    3

    Default

    Quote Originally Posted by janag View Post
    hi guys, i follow your steps and make my table component as clickable, its work fine,
    and i want one more,
    such as while i clicking the cell in table component(particular value in cell) the concern data will occur on CCC Bar Chart.

    for eg. i click 'order_id' on table component (before i create a data source such as Select bpartner_id, sum(grandtotal) from table_name where order_id=${orderid} group by bpartner_id) the concern data will occur on CCC Bar chart..


    Advance thanks....

    Finally i got answer, it's simple one but i thought myself its a big one....
    just create a function with parameter (parameter resemble what you actually pass a value to bar chart) and finally type Dashboards.fireChange('paramName',paramName.value)......

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.