Here's your immediate problem:

google.setOnLoadCallback(drawTable());

That is calling drawTable and passing the returned value (null) to the 
setOnLoadCallback call.  Since the API is not guaranteed to be loaded at 
this point, the drawTable function could be throwing errors due to improper 
loading procedures.  The proper way to use setOnLoadCallback in a situation 
like this is to make sure that no code that *might* cause any API elements 
to be created at some point doesn't run until the API is loaded.  In your 
case, something is calling the results function (I can't tell what because 
you didn't include your full code); you need to trace back the execution of 
results and make sure that whatever code initially triggers that is waiting 
on the API's load callback.

As an example, let's say you have a button (id = "myButton") that calls 
results when clicked, and it is set up like this:

$(document).ready(function () {
    $('#myButton').click(results);
});

You would need to change that to set up the click event when the API loads:

function init () {
    $('#myButton').click(results);
}
google.setOnLoadCallback(init);

On Monday, November 25, 2013 12:52:40 AM UTC-5, [email protected] wrote:
>
> I'm able to pass a JSON string from the servlet and populate a DataTable 
> with no problems.  When I create a dashboard and controls, I get the 
> following errors:
> One or more participants failed to draw()×
> The control type is not defined.
>
> I'm unable to find the error.  Requesting any assistance.  Thank you  RI
>
> Code:
> <script type="text/javascript" >
>                         //Load the Visualization API and the table package
>                         //google.load('visualization', '1', {packages: 
> ['table']});
>                         google.load('visualization', '1.1', {packages: 
> ['controls']});
>
>                         //Initialize global variable
>                         var lucene_data = "";
>
>
>                         function results() {
>
>                             var val = $("#text_search_box").val();
>
>                             $("#results_div").css('display', 'block');
>
>                             $("#div_rt_functions").css('display', 'block');
>                             $("#div_rt_functions").addClass('prefix10');
>
>
>                             $.post("Search",
>                                     {
>                                         txt_search: val
>                                     },
>                             function(data, status) {
>
>                                 lucene_data = data;
>                                 google.setOnLoadCallback(drawTable());
>
>                             });
>
>                         }
>
>                         function drawTable() {
>
>                             //Instantiate and draw our chart, passing in 
> some options
>                             var data_json = jQuery.parseJSON(lucene_data);
>
>                             //Prepare Data
>                             var data = new 
> google.visualization.DataTable(data_json, 0.6);
>                             //Options for the table
>                             var options = {'height': 500, 'width': 650};
>                             
>                             //Create a standard table
>                             //var table = new 
> google.visualization.Table(document.getElementById('results_div'));
>
>                             //Define string filter for Name field
>                             var control = new 
> google.visualization.ControlWrapper({
>                                 'chartType': 'NumberRangeFilter',
>                                 'containerId': 'div_table_controls',
>                                 'options': {
>                                     'filterColumnLabel': 'TotalAmount'
>                                 }
>                             });
>
>                             //Define table
>                             var table = new 
> google.visualization.ChartWrapper({
>                                 'chartType': 'Table',
>                                 'containerId': 'results_div'
>                                 options: options
>                             });
>                             
>                             var dashboard = new 
> google.visualization.Dashboard(document.getElementById('div_dash'));
>
>                             dashboard.bind(control, table);
>                             dashboard.draw(data_json);
>
>
>                             //Draw Standard Table
>                             //table.draw(dataresults, options);
>
>                         }
>
> </script>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-visualization-api.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to