Hello,
I want to make a website that will let users input how they want to filter
the data view. I have everything working except the input. The user enters
how they want to filter the data into a HTML input box and the JavaScript
takes the input and evaluates the string as code using
new Function(input)
*input* is the variable that contains the string that the user entered.
ex.
view.getFilteredRows([{column: 1, minValue: new Date(2007, 0, 1)}])
This function is placed into the *setRows* method. And that is where it
breaks because for some reason, the evaluated string returns undefined.
Example of what my code looks like:
function filter(t) {
//instantiate data view
var view = new google.visualization.DataView(data);
// if query not empty, pass into 'new Function()' and then into
'setRows'
// if I don't add "view" argument, it tells me that view is undefined
if you have it in the query like the example
if (t.rowQuery.value) {
var rowQuery = new Function("view", t.rowQuery.value.split('/'));
view.setRows(rowQuery(view));
}
// draw data view
chart.draw(view, {allowHtml: true, showRowNumber: true});
}
I originally wanted to use Google's query, but I couldn't get it to work
for any other source except Google spreadsheet.
--
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/d/optout.