Hitachi Vantara Pentaho Community Forums
Results 1 to 4 of 4

Thread: SelectComponent event

  1. #1

    Default SelectComponent event

    I'm having problem to add an event to a SelectComponent:

    Code:
    components[components.length] = {    
            name: "listaExercicios", type: "selectComponent",
            solution: solution, path: path,
            action: "getExercicios.xaction",
            parameters:[],        
            htmlObject: "listaExercicios",
            postExecution:function(){
                $(document).ready(function(){
                       $("select").prepend("<option value='All' selected='selected'>Todos</option>");
                });
                Dashboards.processChange(this.name);
            },    
            preChange: function(){
                alert("Running the preChange!");
            },
            executeAtStart: true
        };
    Is this the correct way to fire the changes in SelectComponent??

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

    Default

    You shouldn't need to have a .ready function in there

    try just (although you could try fireChange(this.name,"All"):

    postExecution:function(){
    $("select").prepend("<option value='All' selected='selected'>Todos</option>");
    Dashboards.processChange(this.name);
    },
    Pedro Alves
    Meet us on ##pentaho, a FreeNode irc channel

  3. #3

    Default

    I think I have to explain more!

    I'm creating a dashboard with one SelectComponent and two bar charts. My intention is when a user select a year in SelectComponent my charts change the information. So, my problem is linking the select event of SelectComponent with the chart.
    I've read some documentation about CDF and understood that the way to do this is calling "Dashboards.processChange" method and implementing "preChange: function()", but it isn't working!

    Is this the correct way to do this??

    P.S.: Thanks pmalves, .ready function really isn't necessary.

  4. #4

    Smile Solved

    I used simple jquery methods:

    Code:
    $(document).ready(function(){
            $("#listaExercicios").change(function(){
                var valor=$("#listaExercicios option:selected").val();
                Dashboards.fireChange(valorExercicio,valor);
            });
        });
    This worked fine!

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.