You don't have to render it as a table, you can grab data from the
DataTable (use the
DataTable#getValue<https://developers.google.com/chart/interactive/docs/reference#DataTable_getValue>and
#getFormattedValue<https://developers.google.com/chart/interactive/docs/reference#DataTable_getFormattedValue>methods
to pull data) and use it however you like.
On Sunday, June 23, 2013 12:15:58 AM UTC-4, Brian Pitts wrote:
>
> Does anyone know an easy way to render the result of the google query
> below as an HTML page containing just the text of the result rather than a
> table? For example,
>
> <h1>results</h1>
> <p>(result 1)</p>
> <p>(result 2)</p>
> <p>(result 3)</p>
>
> etc
>
>
>
> [code]
> <?php
> $search= $_REQUEST['search'];
> if ($search > ''){ $search = $search;} else { $search = '';}
> ?>
>
> <script type="text/javascript" src="http://www.google.com/jsapi"></script>
> <script type="text/javascript">
> google.load('visualization', '1', {packages: ['table']});
> </script>
> <script type="text/javascript">
> var visualization;
>
> function drawVisualization() {
>
> var query = new google.visualization.Query(
> '
> https://docs.google.com/spreadsheet/ccc?key=0Ag9GQEChPT0edG44SzI2b29pTTRadXl3ZXczZWNIYWc&usp'
> );
>
>
> query.setQuery('SELECT A, B, C where upper(A) like upper("%<?php echo
> $search; ?>%") or upper(B) like upper("%<?php echo $search; ?>%") order by
> A asc label A "COL1", B "COL2", C "COL3"');
> query.send(handleQueryResponse);
> }
>
> function handleQueryResponse(response) {
> if (response.isError()) {
> alert('Error in query: ' + response.getMessage() + ' ' +
> response.getDetailedMessage());
> return;
> }
>
> var data = response.getDataTable();
>
> visualization = new
> google.visualization.Table(document.getElementById('table'));
> visualization.draw(data, {legend: 'bottom'});
>
> }
>
> google.setOnLoadCallback(drawVisualization);
> </script>
>
> <div id="table"></div>
>
> </div>
> [/code]
>
--
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.