Skip to content

Instantly share code, notes, and snippets.

@goja288
Last active February 25, 2024 17:30
Show Gist options
  • Save goja288/833b2e6c6ff34b4b8f5fe9d6e3ea6dc8 to your computer and use it in GitHub Desktop.
Save goja288/833b2e6c6ff34b4b8f5fe9d6e3ea6dc8 to your computer and use it in GitHub Desktop.
Ctools - Frequently used functions
// With RequireJS
function getLoggedUser() { return this.dashboard.context.user; } // Retorna el usuario de pentaho que esta logueado. por ejemplo "admin"
function getParameter() { return "My Parameter: " + this.dashboard.getParameterValue("myParam"); } // Obtener parametros
function setParameters(v1,v2) { // fire two parameter change
this.dashboard.setParameter('prm1', v1);
this.dashboard.setParameter('prm2', v2);
this.dashboard.fireChange('updateEvent', $.now()); // component listen to 'updateEvent' instead of the two other parameters
}
function log(scene) {
this.dashboard.log("Click sobre " + scene.vars.category.value);
} // Se loguea en la consola de js el valor
function getClickTargetFromTable(rowObject) {
rowObject.tableData[rowObject.rowIdx][0]; // rowObject.tableData[rowObject.target.context._DT_CellIndex.row][0];
}
// Without Requirejs
Dashboards.fireChange("myParam",value);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment