Reputation: 10961
I'm developing a JavaScript application using Google Visualization API. I wrote a event listener so whenever the user clicks in the column, he has the option to hide it, if he does not want to see it.
google.visualization.events.addListener(table, 'select',
function selectHandler(){
var data_table = table.getDataTable();
confirm("hide column?", "Yes", "No");
alert(data_table.removeColumn(0));
}
);
I get the following error:
data_table.removeColumn is not a function
alert(data_table.removeColumn(0));
The API description can be seen here. It's interesting why the first alert tells me "30", the number of columns in the table, while the removeColumn(index)
function does not do anything at all. Any Thoughts?
Thanks
Upvotes: 2
Views: 138
Reputation: 303224
I suspect that perhaps data_table
is not, in fact, not the type of object you expect.
Have you used console.dir
to look at the methods available on it?
Upvotes: 0
Reputation:
I assume you're saying that the second two alerts don't happen.
If so, it's probably because of this typo...
// -----------------------v
alert(data_table.removeColum(1)); // missing "n"
Upvotes: 1
Reputation: 453
Is it because your code snippet invokes removeColum
instead of removeColumn
?
Upvotes: 2