Solved... it was easy.
here's the solution, I hope that could be helpful for someone...
$('.fieldsel').click(function() {
var allVals = new Array();
$('#selectcampi :checked').each(function() {
allVals.push($(this).val());
});
var collist = '{"columns":[' + allVals.toString() + ']}';
table.setView(collist);
table.draw();
});
Bye,
Marco
Il giorno mercoledì 14 novembre 2012 16:23:37 UTC+1, Marco Megna ha scritto:
>
> Hi,
> i've built this function that should redraw a table making me choose the
> fields.
> When i click on a checkbox (.fieldsel), i take all the checked value in a
> form(#selectcampi) and put them in allVals array.
>
> ....
> $('.fieldsel').click(function() {
> var allVals = new Array();
>
> $('#selectcampi :checked').each(function() {
> allVals.push($(this).val());
> });
>
> var v = new google.visualization.DataView(data);
> v.setColumns(allVals);
>
> table.setView(v.toJSON());
> table.draw();
> });
>
> The problem is that v.setColumns(); doesn't accept this array.
> The error is:
> Uncaught Error: Invalid column input, expected either a number or an
> object.
>
> How could i pass to .setColumns() a list of columns properly?
> Or maybe there is a way to pass it directly to .setView() without declare
> a .DataView?
>
> Thanks!
> Marco
>
--
You received this message because you are subscribed to the Google Groups
"Google Visualization API" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/google-visualization-api/-/JfDH_cJPM28J.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-visualization-api?hl=en.