The #getOption method only returns options that you set - there is no way 
to get the specific list of values from the control (at least, not 
according to the documentation).  You can, however, group the DataTable on 
the filtered column to get the total number of unique values, and use that 
instead:

google.visualization.events.addListener(personPicker, 'ready', function() {
    // get column index, can also use filterColumnLabel, if you set that 
option instead
    // if you use filterColumnLabel, you will need to translate it back 
into an index for the group
    var columnIndex = personPicker.getOption('filterColumnIndex');
    var group = google.visualization.data.Group(data, [columnIndex]);
    
    var numpersons = group.getNumberOfRows();
    
    alert('numpersons=' + numpersons);
    if (numpersons > 1) {
        $('div#personfilter').css('display', 'inline-block');
        $('div#personfilter').css('visibility', 'visible');
    } else {
        $('div#personfilter').css('display', 'none');
        $('div#personfilter').css('visibility', 'hidden');
    }
}); 

On Friday, July 6, 2012 11:01:14 AM UTC-4, T-Roy wrote:
>
> I am trying to get this code to work on a category filter: 
>
>      google.visualization.events.addListener(personPicker, 'ready', 
> function(){
>           //alert('modify personPicker visibility');
>           var categoryValues = personPicker.getOption('values');
>           alert(categoryValues);
> //categoryValues is always null ???
>           if (categoryValues){
>                numpersons = categoryValues.length();
>           }else{
>                numpersons = 1;
>           }
>           alert('numpersons='+numpersons);
>           if(numpersons>1){
>                $('div#personfilter').css('display','inline-block');
>                $('div#personfilter').css('visibility','visible');
>           }else{
>                $('div#personfilter').css('display','none');
>                $('div#personfilter').css('visibility','hidden');
>           }
>      });
>
>
> How/When can I get the number of items in the category filter?
>
> Thanks?
>

-- 
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/-/nSiVGHnldNQJ.
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.

Reply via email to