emmorts
emmorts
WWindmill
Created by emmorts on 2/2/2024 in #help
Triggering a script or flow from AgGrid Table column definition
Ah, I see - that works like a charm, thanks @Faton!
9 replies
WWindmill
Created by emmorts on 2/2/2024 in #help
Triggering a script or flow from AgGrid Table column definition
Oh, that does makes sense though, seeing as this is a frontend function, while imports are only allowed in backend functions. That does leave me stuck still - how can I trigger a backend function on a button click?
9 replies
WWindmill
Created by emmorts on 2/2/2024 in #help
Triggering a script or flow from AgGrid Table column definition
My current background runnable looks something like this:
// import { main as foo } from '/f/anki/answer_cards.ts'; // ERROR: import declarations may only appear at top level of a module

class BtnCellRenderer {

constructor() { }
init(params) {
this.params = params;
this.eGui = document.createElement('button');
this.eGui.innerHTML = 'foo';
this.btnClickedHandler = this.btnClickedHandler.bind(this);
this.eGui.addEventListener('click', this.btnClickedHandler);
}
getGui() {
return this.eGui;
}
destroy() {
this.eGui.removeEventListener('click', this.btnClickedHandler);
}
}
BtnCellRenderer.prototype.btnClickedHandler = function () {
const data = { ...this.params.data };
this.params.api.applyTransaction({ remove: [data] });
};

return [
{
headerName: 'Actions',
cellRenderer: BtnCellRenderer
}
];
// import { main as foo } from '/f/anki/answer_cards.ts'; // ERROR: import declarations may only appear at top level of a module

class BtnCellRenderer {

constructor() { }
init(params) {
this.params = params;
this.eGui = document.createElement('button');
this.eGui.innerHTML = 'foo';
this.btnClickedHandler = this.btnClickedHandler.bind(this);
this.eGui.addEventListener('click', this.btnClickedHandler);
}
getGui() {
return this.eGui;
}
destroy() {
this.eGui.removeEventListener('click', this.btnClickedHandler);
}
}
BtnCellRenderer.prototype.btnClickedHandler = function () {
const data = { ...this.params.data };
this.params.api.applyTransaction({ remove: [data] });
};

return [
{
headerName: 'Actions',
cellRenderer: BtnCellRenderer
}
];
9 replies
WWindmill
Created by emmorts on 2/2/2024 in #help
Triggering a script or flow from AgGrid Table column definition
I can't seem to get import definitions to work in Background Runnables, receiving
{
"error": {
"message": "import declarations may only appear at top level of a module"
}
}
{
"error": {
"message": "import declarations may only appear at top level of a module"
}
}
9 replies