如何根据标题更改ControlWrapper类别过滤器ui.caption文本颜色?我尝试了下面的代码,但它不起作用。
var category_Picker = new google.visualization.ControlWrapper({
'controlType': 'CategoryFilter',
'view': {'columns': [1,2,3,4,7,8]},
'containerId': 'category_filter_container',
'options': {
'filterColumnLabel': 'P/A',
'ui': {
'matchType':'any',
'label': '',
'caption':'All',
'labelStacking': 'horizontal',
'allowTyping': false,
'allowMultiple': false,
'cssClass':'category_Picker_Class'
}
},
'state':{'selectedValues':['A']}
});
var table = new google.visualization.ChartWrapper({
'chartType': 'Table',
'containerId': 'summary_details_table',
'options': {'allowHtml': true,'alternatingRowStyle':true,'width':'100%','height':'600px'}
});
// Create the dashboard.
var data_DashBoard = new google.visualization.Dashboard(document.getElementById('summary_details_table')).bind(category_Picker, table).draw(view);
$(".category_Picker_Class").css({"color":"red"});
答案 0 :(得分:1)
尝试将jQuery包装在" ready"控件的事件处理程序,因为在您尝试设置CSS时控件可能不存在:
google.visualization.events.addListener(category_Picker, 'ready', function () {
$(".category_Picker_Class .charts-menu-button-caption").css({"color":"red"});
});
将事件处理程序置于创建CategoryPicker和绘制仪表板之间。 jsfiddle example