In Techno
It’s very difficult to title this blog, cause it might be misleading.

So what this is all about is to use the right model for finding stuff on the AIKAU page.
What I’ve seen most people (even my colleagues) use this piece of code:

var model = widgetUtils.findObject(model.jsonModel, "id", "some id which is on top of the .js code");
for (var i = 0; i < model.config.widgets.length; i++) {
    if (model.config.widgets[i].id == ""{
        //Do something awesome
    }
}
But what they forget is that to find the widgets directly you need to supply model.widgets instead of model.jsonModel.

So this will look like this (real working example):

var userProfile = widgetUtils.findObject(model.widgets, "id", "UserProfile");

userProfile.id = "CustomUserProfile";
userProfile.name = "Custom.UserProfile";
//Make everyone's last name Malik
userProfile.options.profile.lastName = "Malik"
So this is much quicker, looks nicer and you don’t need to loop through all the code before getting to the widget to change stuff.
Recent Posts

Start typing and press Enter to search