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

SDK error on add a widget to page

$
0
0

Hi All,

I have a problem when I try to add a widget like simple Text or anything using the SDK to a page. 

When I create a new app and there is a page it works, but the "LayoutCallArgument" is out of the "LayoutCall" and this is the problem, Why this happen? 

Maybe the Modeller did not understand where to insert the LayoutCallArgument. 

I am using auto generated code from Reverse engineering for simple page with only text:

    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);

//Bellow is where something must be changed I think

    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);

// End of region

    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;

 

When I try to update an  app and I add a new page using the code above, or I simply try to add widget like Text to

already created page without content, this error is throwned by the Modeller 

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 ---

All elements have  auto generated ID so the ID of the 'LayoutCallArgument' is not a problem, maybe the ID of a missing element cause the error, as there is not an element the id is null.

Of course it is possible that this is a bug. I've tryed adding IDs  but there is not an effect.

 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

Did anybody in this forum ever created an app with  page and simple widget inside using SDK ? If so,  please tell me where is the problem or post the code. 

Thanks.  


Viewing all articles
Browse latest Browse all 81864

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>