|
25 | 25 | vizSettingsHaveChanged(false);
|
26 | 26 | };
|
27 | 27 |
|
| 28 | + // Update google chart filter control. |
| 29 | + window.vizUpdateFilterControl = function() { |
| 30 | + $( '#control_wrapper_canvas' ).removeClass( 'no-filter' ); |
| 31 | + var controlsOpt = $( '.vz-controls-opt' ).map( |
| 32 | + function() { |
| 33 | + var val = $(this).val(); |
| 34 | + return '' !== val && 'false' !== val ? val : false ; |
| 35 | + } |
| 36 | + ).get(); |
| 37 | + controlsOpt = controlsOpt.filter( function(el) { return el; } ); |
| 38 | + if ( controlsOpt.length === 0 ) { |
| 39 | + $( '#control_wrapper_canvas' ).addClass( 'no-filter' ).html(''); |
| 40 | + } |
| 41 | + } |
| 42 | + |
28 | 43 | $('#settings-button').click(function() {
|
29 | 44 | $('#settings-form').submit();
|
30 | 45 | });
|
|
42 | 57 | // this portion captures if the settings have changed so that tabs can handle that information.
|
43 | 58 |
|
44 | 59 | function updateChart() {
|
| 60 | + vizUpdateFilterControl(); |
45 | 61 | clearTimeout(timeout);
|
46 | 62 | timeout = setTimeout(function() {
|
47 | 63 | var settings = $('#settings-form').serializeObject();
|
|
72 | 88 | });
|
73 | 89 | $('textarea[name="manual"]').change(validateJSON).keyup(validateJSON);
|
74 | 90 |
|
75 |
| - $( document ).on( 'change', '.vz-controls-opt', function() { |
76 |
| - $( '#control_wrapper_canvas' ).removeClass( 'no-filter' ); |
77 |
| - var controlsOpt = $( '.vz-controls-opt' ).map( |
78 |
| - function() { |
79 |
| - var val = $(this).val(); |
80 |
| - return '' !== val && 'false' !== val ? val : false ; |
81 |
| - } |
82 |
| - ).get(); |
83 |
| - controlsOpt = controlsOpt.filter( function(el) { return el; } ); |
84 |
| - if ( controlsOpt.length === 0 ) { |
85 |
| - $( '#control_wrapper_canvas' ).addClass( 'no-filter' ).html(''); |
86 |
| - } |
87 |
| - } ); |
88 | 91 | });
|
89 | 92 | })(jQuery, visualizer);
|
90 | 93 |
|
|
0 commit comments