Find Widgets with Mendix Model SDK

1
Hi everyone, my question is how i can get all Widgets, which are used on a specific page in Mendix Model SDK 4.x? Thanks for your answers.   greetings Jochen
asked
3 answers
1

Check in this example how they iterate over all the different parts of an application:

https://github.com/simo101/sdkuservisualisation/blob/master/script.ts

Also check https://apidocs.mendix.com/modelsdk/latest/modules/pages.html for the different page elements you can traverse through.

answered
1

Hi Jochen,

I did something similar for custom widgets , The sample is in Type script

 

function findCustomWidgets(page: pages.Page): when.Promise<customwidgets.ICustomWidget[]> {
    return when.promise<customwidgets.ICustomWidget[]>((resolve) => {
        const widgetList: customwidgets.ICustomWidget[] = [];
        page.traverse((structure) => {
            if (structure instanceof pages.Widget && structure.typeName === "CustomWidgets$CustomWidget") {
                widgetList.push(structure);
            }
        });
        resolve(widgetList);
    });
}

Cheers,

Andries

answered
0

Thanks for your answers, i think this will gonna help me.

greetings

Jochen

answered