Where to register a new cell renderer to CellRendererRegistry?

hey,
I’d like to use the new cell renderer in my extension but I’m not sure where to actually call that method.

I tried adding it to my controller.js

CellRendererRegistry.addRenderer(
    'pac-value-renderer', 
    new PacValueCellRenderer(), 
    "error"
);

but I get the error during my extension initialization

org.mozilla.javascript.EcmaError: ReferenceError: "CellRendererRegistry" is not defined. (file:/Users/jan/xworkspace/openrefine-cleaner/module/MOD-INF/controller.js#89)

I tried calling the same function in the Chrome dev tools and the renderer is registered correctly but not called when rendering the cells

I noticed that when reload my dataset, the render is gone again from the registry

thanks in advance for your help

So it looks like registering it in any of my other .js scripts works as expected :+1:

1 Like

It’s not very clear from the documentation but controller.js is a special type of JavaScript file only meant for initialization and URL routing, it’s not executed on the client and doesn’t support all JavaScript syntax.

yes, by debugging the main project, I figured that the controller.js is not actually front end code.

thanks for the clarification