所以我正在使用 PivotTable.js,它对工作有很大帮助。
但现在,我正在尝试获取一个过滤器来根据值更改单元格的颜色或单元格内的字体。
例如,如果我的数据集中有一个日期数组
dates = ["N/A", "4/12/2016", "7/9/2024", "7/9/2024", "4/1/2013"]
我想让 2016 年 6 月 1 日之前的任何日期都可以更改颜色。
我将我的数据作为变量“数据”在本地传递(如果这有什么区别)
$(function(){
var derivers = $.pivotUtilities.derivers;
var renderes = $.extend($.pivoUtilities.renderers, $.pivotUtilities.export_renderers);
$("#pivot_table").pivotUI(data, {
derivedAttributes: function(data){
// not sure how to access the css of the element from here
}
rows: [],
cols: ["Name", "Date", "Organization", "Cost"],
renderers: renderers,
rendererName: "Table"
});
});
我尝试过进入衍生属性,但我尝试的一切都不起作用。
任何帮助或集思广益将不胜感激