我目前正在使用一个基于Js生态系统的Python Web框架来创建交互式页面,我想知道是否有一种方法可以创建定制的格式化程序,并进行一些逻辑处理,然后在Js现有的格式化程序中重用。
我看了看代码,设法获得了格式工厂,然后能够更改单元格CSS样式,但是我想知道是否已经为此准备好了东西。
有关信息,这是在Python上生成的代码,该代码已插入制表符定制的格式定义中:
function(cell, formatterParams){
const cssAttrs = formatterParams.css;
var cell = cell.getTable().modules.format.getFormatter('%s').call(cell.getTable().modules.format, cell, formatterParams);
let frag = document.createRange().createContextualFragment(cell).firstChild;
Object.keys(cssAttrs).forEach(function(key){frag.style[key] = cssAttrs[key]});
return frag;
}