Skip to main content

onListDimensionGroupFolders

Last updated 8/03/2026

Dimension group folder listing handler

This example demonstrates how the

callback sends a request using the Fetch API to retrieve dimension group folders for a project. Once the request completes, the result and returned folders are provided to the widget through the

onResponse
callback.

TypeScript
Dimension group folder listing handler
onListDimensionGroupFolders = async function(projectKey: string, onResponse: (result: DIQ_Result, groupFolders: Array<DIQ_DimensionGroupFolder> | null) => void) {
try {
const res = await fetch(`/api/projects/${projectKey}/dimension-group-folders`);

if (!res.ok) {
throw new Error(`HTTP ${res.status}`);
}

const folders = await res.json();

onResponse(
{ ok: true },
folders
);

} catch (err) {
onResponse(
{
ok: false,
message: err.message || "Failed to fetch folders"
},
null
);
}
};