I've figured out how to make an embedded google spreadsheet sortable, but I can't get it to be searchable.

http://ybpdatabase.blogspot.com/ is my site, and I have no access to or knowledge of php. In the past I've used another piece of google code to achieve these results (see my table @ http://ybpdatabase.blogspot.com/2012/10/database-search.html), but I had to manually insert each entry, rather than use the simpler embedded spreadsheet. I've posted the current code below. Any help would be great. Thanks!

<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=0AmWD_Na4J_4BdDllczJiVHFibnYwd2FabjhiQmlmZmc');

query.setQuery('SELECT A, B, C, D, E, F, G, H, I, J, K order by A asc label A "Name", B "M/F", C "Class", D "State", E "Height", F "Weight", G "Wing", H "Vert", I "Speed", J "Shot", K "Last Insp."');
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>

Recommended Answers

All 4 Replies

Member Avatar for LastMitch

How can I make my sortable table searchable?

I think you post this question in the wrong section.

Rather than HTML/CSS it sohuld have been in Javascript.

You can used a plugin like this one:

http://tablesorter.com/docs/

or this one:

http://joequery.github.com/Stupid-Table-Plugin/

Both links and example has Html/CSS and jQuery.

So you can modify it.

Thanks. Sorry for the mis-post. Not knowing where to start is usually my greatest obstacle.

As for the links you provided, they don't include search. I'm familiar with plugins like those. I believe the only way to do search is through php... which I have no server for. I imght be screwed on this one.

Member Avatar for LastMitch

I believe the only way to do search is through php... which I have no server for. I imght be screwed on this one.

Not necessary. You can used jQuery list:

http://listjs.com/

Since I look over your table it's kinda like a Excel Spreadsheet.

I mean you try this

http://listjs.com/examples/add-edit-remove

I mean you can always comment the button so noone can edit stuff.

If you need to edit and add stuff just uncomment the button and add the stats while online.

If someone was to type something to search it will get the stats.

I think you might need to redesign your table from the spreadsheet format to the webpage format.

I'm not a basketball fan but stats are not bad to read.

That's an awesome link. Thank you so much!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.