var customerData = GetCustomerData("2013/01/01", "2014/12/30");
            var columnsTable = new 
google.visualization.DataTable(customerData);
            var initState = { selectedValues: [] };
            //initState.selectedValues.push(columnsTable.getColumnLabel(1));

            function GetCustomerData(startDate,endDate) {
                var jsondata = "";
                $.ajax({
                    type: "POST",
                    url: 'ColumnCharts.aspx/GetCustomerData',
                    contentType: "application/json; charset=utf-8",
                    dataType: "json",
                    data: JSON.stringify({ startDate: startDate, endDate: 
endDate }),
                    
                    async: false,
                    success: function (msg) {
                        jsondata = msg.d;
                    }
                });

               
                return jsondata;

            }


            var columnFilter = new google.visualization.ControlWrapper({
                controlType: 'CategoryFilter',
                containerId: 'colFilter_div',
                dataTable: columnsTable,
                options: {
                    filterColumnLabel: 'Name',
                    ui: {
                        label: 'Customers',
                        allowTyping: true,
                        allowMultiple: true,
                        allowNone: false,
                        selectedValuesLayout: 'aside'
                    }
                },
                state: initState
            });



            document.getElementById('btnGetTop10Cust').onclick = function 
() {
                var startDate = document.getElementById('TextBox1').value;
                var endDate = document.getElementById('TextBox2').value;
                var customerData = GetCustomerData(startDate, endDate);

                columnsTable = new 
google.visualization.DataTable(customerData);                

                columnFilter.setDataTable(columnsTable);
                columnFilter.draw();
            }



On Saturday, September 20, 2014 5:18:01 AM UTC+5:30, Andrew Gallant wrote:
>
> You need to call filter.setDataTable in the handler:
>
> document.getElementbyId('btnGetData').onclick = function()
> {
>     data = GetData();
>     filter.setDataTable(data);
>     filter.draw();
> }
>
> On Friday, September 19, 2014 12:16:23 PM UTC-4, Shivani Kanakhara wrote:
>>
>> I am using a category filter where i pass data using ajax. 
>> Now i want to change the data passed to the filter on button click.
>> I am doing something like this but it is not working:
>>
>>
>> var data;
>> document.getElementbyId('btnGetData').onclick = function()
>> {
>>       
>>       data = GetData()
>>       filter.draw();
>> }
>>  var filter = new google.visulization.ControlWrapper({
>>     'controlType': 'CategoryFilter',
>>     'dataTable':data,
>>     ...
>>     ...
>>    });
>>
>>
>> i guess there is something related to filter.getcontrol() in the ready 
>> event..
>> but not exactly sure.
>> How should exactly the code be?
>>
>>

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

Reply via email to