Hi all, I am having trouble working with a data table. I want to have
three functions for the moment, one to draw the table which calls the
other two functions, one to create the datatable object and create the
row headers this bit works. The second part would be to take that
object and pass by reference so that addRow can add values which will
be pulled from code elsewhere and return the updated datatable object.
This currently isn't working. I would finally like to move the other
functions into the table_functions.jsp file.
I am working on updating a really old code base and the original
author is no longer around which involves JSP and other things hence
the need to have things inside jsp files :|
Any help would be fantastic, I have included my attempt thus far for
reference.
Many thanks,
Neil
<% /*Testing the google table*/ %>
<html>
<head>
<jsp:include page="table_functions.jsp"/>
<script type='text/javascript' src='https://www.google.com/jsapi'></
script>
<script type='text/javascript'>
google.load('visualization', '1', {packages:['table']});
google.setOnLoadCallback(drawTable);
function drawTable() {
var data = Init( );
data = addRow( data );
var table = new
google.visualization.Table( document.getElementById( 'table_div' ) );
table.draw( data, {showRowNumber: true} );
}
function Init( ) {
var data = new google.visualization.DataTable();
/* Create columns */
data.addColumn('string', 'Suite Name');
data.addColumn('string', 'Updated');
data.addColumn('number', 'Jobs');
data.addColumn('number', 'Pages');
data.addColumn('number', 'Failing');
data.addColumn('string', 'Diff, Fixed, Broke');
data.addColumn('number', 'Crash');
data.addColumn('number', 'Timeouts');
data.addColumn('string', 'Asrts, Errs, Warns');
data.addColumn('string', 'Hrs');
data.addColumn('number', 'Size(MB)');
return( data );
}
function addRow( var data ) {
data.addRows( 1 );
data.setCell( 0, 0, "Suite1" );
data.setCell( 0, 1, "Yesterday at 11:10 GMT" );
data.setCell( 0, 2, 24, '24' );
data.setCell( 0, 3, 48, '48' );
data.setCell( 0, 4, 0, '0' );
data.setCell( 0, 5, '(-23) *,(12) *,(10) *' );
data.setCell( 0, 6, 0, '0' );
data.setCell( 0, 7, 0, '0' );
data.setCell( 0, 8, '(0),(0),(0)' );
data.setCell( 0, 9, '19:20' );
data.setCell( 0, 10, 9999, '9999' );
return( data );
}
</script>
</head>
<body>
<div id='table_div'></div>
</body>
</html>
</html>
--
You received this message because you are subscribed to the Google Groups
"Google Visualization API" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-visualization-api?hl=en.