Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Apr 2014
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How to trigger event in javascript?

    I am trying to trigger a logic in java script, which will allow the user to render [table] when they click on the control[categoryPicker, stringFilter]. Currently, nothing is rendering when I click on the controls[categoryPicker, stringFilter]. Please advice.

    Code:
    var table = new google.visualization.ChartWrapper({
                        'chartType': 'Table',
                        'containerId': 'TableContainer',
                        'options': {
                            'width': '900px'
                        }
                    });
     
    
                    //dummy table holder 
                    var dummy = new google.visualization.ChartWrapper({
                        'chartType': 'Table',
                        'containerId': 'DummyTable',
                        'options': {
                            'width': '300px',
                            'sort': 'disable'
                        },
                        'view': {
                            'rows': []
                        }
                    });
     
                
                    // Create a dashboard
                    var dashboard = new google.visualization.Dashboard(document.getElementById('PieChartExample'));
     
                    google.visualization.events.addOneTimeListener(dashboard, 'ready', function () {
                        // create a "ready" event handler for the dummy
                        // this fires whenever the user interacts with the controls
                        google.visualization.events.addOneTimeListener(table, 'ready', function () {
                            // get the data for the table
                            //var dt = dummy.getDataTable();
                            var dt = table.getDataTable();
                            // set the table's data
                            table.setDataTable(dt);
                            // draw the table
                            table.draw();
                        });
     
                    });
                   
                    // bind the control to the dummy chart
                    dashboard.bind([categoryPicker, stringFilter], [dummy]);
                    // Draw the dashboard
                    dashboard.draw(data);
     
            }
    I have tried, debugging it, in the browser console, but I am getting no couple of warnings such as:
    Empty string passed to getElementById(). --> increment count(whenever i click on Date controller)

    Any help would be very much appreciated.

  • #2
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,350
    Thanks
    11
    Thanked 589 Times in 570 Posts
    make sure your javascript loads from the bottom of the <body>, after the charts you are drawing. posting or linking the full page would help.
    my site (updated 13/9/26)
    BROWSER STATS [% share] (2014/5/28) IE7:0.1, IE8:5.3, IE11:8.4, IE9:3.2, IE10:3.2, FF:18.2, CH:46, SF:7.9, NON-MOUSE:32%


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •