Thanks very much! It looks like it's working. You've just made my life
easier.
I'll probably try to copy it for another spreadsheet too. Thanks!
On Thursday, August 8, 2013 4:34:19 PM UTC-4, asgallant wrote:
>
> Add a target="_blank" parameter to the anchor tag in the formatter:
>
> var formatter = new google.visualization.PatternFormat('<a
> href="{0}" target="_blank">{0}</a>');
>
> On Thursday, August 8, 2013 3:39:19 PM UTC-4, BuildingtheNextGen wrote:
>>
>> Wow! You are great! I have been trying to get this resolved for a few
>> days and you are making my life easy. :)
>>
>> It looks like I got everything to work, but found one other issue. I
>> noticed that all of the links open up in the same window. Is there an easy
>> enough way to have the links open the file in another window?
>>
>> On Thursday, August 8, 2013 1:49:41 PM UTC-4, asgallant wrote:
>>>
>>> Some of the URL's in the spreadsheet aren't formatted correctly (eg, "
>>> www.google.com" is missing the "http://" piece, and the "click me"
>>> entry will probably throw a 404 error).
>>>
>>> As far as the search goes, check to make sure your query string is
>>> correct. I copied the string from your rendered javascript, not the
>>> pre-rendered PHP, so if you copied my code exactly, you are probably
>>> missing that part.
>>>
>>> On Thursday, August 8, 2013 12:58:00 PM UTC-4, BuildingtheNextGen wrote:
>>>>
>>>> Also, it looks like the search function doesn't work any more either.
>>>> Did I copy of the code wrong?
>>>>
>>>> On Thursday, August 8, 2013 12:31:57 PM UTC-4, BuildingtheNextGen wrote:
>>>>>
>>>>> Oh man, we were getting so close & you would be a life saver. :) I can
>>>>> now click on the link, but unfortunately, it's not directing it to the
>>>>> site. Instead, it's adding it on to the domain instead of opening up the
>>>>> URL on it's own. Any thoughts to resolve that?
>>>>>
>>>>> Again, thanks so much for the help with this.
>>>>>
>>>>> On Wednesday, August 7, 2013 11:34:10 PM UTC-4, asgallant wrote:
>>>>>>
>>>>>> There are a few errors you need to fix:
>>>>>>
>>>>>> 1) you are missing the "function drawVisualization ()" descriptor
>>>>>> before the start of the function call
>>>>>> 2) you created a formatter, but didn't use it to format anything.
>>>>>> Also, with the format specified, it won't create links that go anywhere.
>>>>>> 3) you have a table.draw call that shouldn't be there
>>>>>>
>>>>>> I fixed these for you and did a mockup here:
>>>>>> http://jsfiddle.net/asgallant/SGfEu/
>>>>>>
>>>>>>
>>>>>> On Wednesday, August 7, 2013 8:41:47 PM UTC-4, BuildingtheNextGen
>>>>>> wrote:
>>>>>>>
>>>>>>> Thanks for the response. Here's the page source:
>>>>>>>
>>>>>>> <form id="form1" method="post" action ="/index.php"> <label><input
>>>>>>> id="search" name="search" type="text" /></label><label><input
>>>>>>> type="submit" /></label></form><p><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 query = new
>>>>>>> google.visualization.Query('https://docs.google.com/spreadsheet/ccc?key=0AmOkf3tfSbwedHVmN2FPdUo2Mk9pUkNMQzlhd0F4OHc#gid=0');query.setQuery('SELECT
>>>>>>> A, B, C, D, E where upper(A) like upper("%%") or upper(B) like
>>>>>>> upper("%%") or C like "%%" or upper(D) like upper("%%") or upper(E)
>>>>>>> like upper("%%")order by A
>>>>>>> asc');query.send(handleQueryResponse);}function
>>>>>>> handleQueryResponse(response) {if (response.isError()) {alert('Error in
>>>>>>> query: ' + response.getMessage() + ' ' +
>>>>>>> response.getDetailedMessage());return;}var formatter = new
>>>>>>> google.visualization.PatternFormat('<a href="#">{0}</a>');var data =
>>>>>>> response.getDataTable();visualization = new
>>>>>>> google.visualization.Table(document.getElementById('table'));visualization.draw(data,
>>>>>>> {allowHtml: true, legend: 'bottom'});table.draw(view, {allowHtml:
>>>>>>> true})}google.setOnLoadCallback(drawVisualization);</script><div
>>>>>>> id="table"></div></div>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> On Wednesday, August 7, 2013 7:52:43 PM UTC-4, asgallant wrote:
>>>>>>>>
>>>>>>>> You have used the option correctly, so my guess is that the data
>>>>>>>> being retrieved from the spreadsheet isn't formatted correctly. Could
>>>>>>>> you
>>>>>>>> share a link to the page or post the javascript rendered in a browser
>>>>>>>> (open
>>>>>>>> the page in a browser, view the source, and copy the javascript) so I
>>>>>>>> can
>>>>>>>> test it?
>>>>>>>>
>>>>>>>> On Wednesday, August 7, 2013 7:43:58 PM UTC-4, BuildingtheNextGen
>>>>>>>> wrote:
>>>>>>>>>
>>>>>>>>> I'll begin by saying that I know very, very little about coding at
>>>>>>>>> all. I was hoping to get a google spreadsheet in a searchable format
>>>>>>>>> that
>>>>>>>>> will display only the records related to the keyword search. I found
>>>>>>>>> a
>>>>>>>>> great blog post that helped to explain this. I was able to get the
>>>>>>>>> searchable database. It shows all of the columns on my google
>>>>>>>>> spreadsheet.
>>>>>>>>> However, I have one column with a bunch of URLs. In the google
>>>>>>>>> spreadsheet
>>>>>>>>> itself, it displays with the active links. However, when I use the
>>>>>>>>> script,
>>>>>>>>> it only displays the text (whether I have the actual URL there or the
>>>>>>>>> text
>>>>>>>>> with the link to the URL). I saw in another post that I needed to be
>>>>>>>>> sure
>>>>>>>>> to enter allowHtml: true (case sensitive). However, it does not seem
>>>>>>>>> to
>>>>>>>>> work.
>>>>>>>>>
>>>>>>>>> Does anyone happen to know how to resolve this issue? Below is
>>>>>>>>> what I have for that portion of the coding (Again, I know very little
>>>>>>>>> of
>>>>>>>>> coding. I just copied the entire code & inserted the link to the
>>>>>>>>> google
>>>>>>>>> spreadsheet). Thanks in advance!
>>>>>>>>>
>>>>>>>>> <form id="form1" method="post" action ="<?php echo
>>>>>>>>> $_SERVER['PHP_SELF']; ?>"> <label>
>>>>>>>>> <input id="search" name="search" type="text" />
>>>>>>>>> </label>
>>>>>>>>> <label>
>>>>>>>>> <input type="submit" />
>>>>>>>>> </label>
>>>>>>>>>
>>>>>>>>> </form>
>>>>>>>>> <p>
>>>>>>>>>
>>>>>>>>> <?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 query = new google.visualization.Query(
>>>>>>>>> 'GOOGLE URL GOES HERE');
>>>>>>>>>
>>>>>>>>> query.setQuery('SELECT A, B, C, D, E where upper(A) like
>>>>>>>>> upper("%<?php echo $search; ?>%") or upper(B) like upper("%<?php echo
>>>>>>>>> $search; ?>%") or C like "%<?php echo $search; ?>%" or upper(D) like
>>>>>>>>> upper("%<?php echo $search; ?>%") or upper(E) like upper("%<?php echo
>>>>>>>>> $search; ?>%")order by A asc');
>>>>>>>>>
>>>>>>>>> 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, {allowHtml: true, legend: 'bottom'});
>>>>>>>>>
>>>>>>>>> }
>>>>>>>>>
>>>>>>>>> google.setOnLoadCallback(drawVisualization);
>>>>>>>>> </script>
>>>>>>>>>
>>>>>>>>> <div id="table"></div>
>>>>>>>>>
>>>>>>>>> </div>
>>>>>>>>>
>>>>>>>>
--
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.