Quantcast
Channel: Mendix Forum Questions
Viewing all articles
Browse latest Browse all 80876

SDK error on add a widget to page

$
0
0

I have a problem when I try to add a widget on pages using SDK. This happens only when I am updating a project, If I create a new one with SDK and the same code is inside it works.

So the question is why on "update", when I am adding a  new component in the project (a page with some widget) it throw an error?

 

All other things like creating microflows, domain models , creating pages works, but when decide to add a widget to a page what happen is this error throwed by the Modeller when I Update to see the newly added page:

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentNullException: Value cannot be null.
Parameter name: value  at Mendix.Modeler.WebUI.Forms.Widgets.FormCalls.LayoutCallArgument.set_ParameterId(LayoutParameterIdentifier value) in C:\jenkins\workspace\WebUI-Build-6\modeler\Mendix.Modeler.WebUI\Forms\Widgets\FormCalls\LayoutCallArgument.Generated.cs:line 45  --- End of inner exception stack trace ---

I've added an ID but the error is the same. IT just don't recognice that there is an ID.

The format of the ID is correct, it is like the ProjectID and API key. 

 I am using latest npm packages for model and platform, also my IDE version is 6.10.2 (I installed Mendix 7.0.2 but the same error appear) and

I am using a code which is from reverse engineering -  auto generated.

This is a simple page with a default layout and simple text. On adding the text, the problem is "layoutCallArgument1" bellow which expect an ID to be added according to the error above.

    var translation1 = texts.Translation.create(model);
    translation1.languageCode = "nl_NL";
    translation1.text = "Tekst";

    var translation2 = texts.Translation.create(model);
    translation2.languageCode = "en_US";
    translation2.text = "Hello";

    var text1 = texts.Text.create(model);
    text1.translations.push(translation1);
    text1.translations.push(translation2);

    var clientTemplate1 = pages.ClientTemplate.create(model);
    clientTemplate1.template = text1;   // Note: for this property a default value is defined.

    var text1_1 = pages.DynamicText.create(model);
    text1_1.name = "text1";
    text1_1.content = clientTemplate1;   // Note: for this property a default value is defined.

    var layoutGridColumn1 = pages.LayoutGridColumn.create(model);
    layoutGridColumn1.weight = 12;
    layoutGridColumn1.widget = text1_1;

    var layoutGridRow1 = pages.LayoutGridRow.create(model);
    layoutGridRow1.columns.push(layoutGridColumn1);

    var layoutGrid1 = pages.LayoutGrid.create(model);
    layoutGrid1.name = "layoutGrid1";
    layoutGrid1.rows.push(layoutGridRow1);


    var layoutCallArgument1 = pages.LayoutCallArgument.create(model);
    layoutCallArgument1.widget = layoutGrid1;

    var layoutCall1 = pages.LayoutCall.create(model);
    layoutCall1.layout =
                   model.findLayoutByQualifiedName("NavigationLayouts.Sidebar_Full_Responsive");
    layoutCall1.arguments.push(layoutCallArgument1);

    var translation3 = texts.Translation.create(model);
    translation3.languageCode = "en_US";
    translation3.text = "Page Title";

    var text2 = texts.Text.create(model);
    text2.translations.push(translation3);

    var temp = pages.Page.createIn(unit);
    temp.name = "TestPage";
    temp.canvasWidth = 1200;
    temp.canvasHeight = 600;
    temp.layoutCall = layoutCall1;   // Note: for this property a default value is defined.
    temp.title = text2;   // Note: for this property a default value is defined.
    temp.popupResizable = true;

If you can update successfully an exsisting app with a new page with widgets inside, please post the code, as the reverse engineering not works.


Viewing all articles
Browse latest Browse all 80876

Trending Articles