Calendar Widget Xpath error

0
Hello super Mx users, I am using Mendix 5.5.0 and I am using the Calendar Widget. I created a page where there is a datagrid (GRID 1). In this datagrid I can select a court. The other grid (GRID 2) is a grit that listens to the first datagrid (GRID 1). In this datagrid, I want to show the courtdays (in the calendar Widget)! To realize this I used a X-Path like below in the calendar Widget. [ActivityPlanner.CourtDays_Court = '[%CurrentObject%]'] The problem is that every time a try to open the page I get the following error in the Mendix console. (I showed a part of the error) com.mendix.core.CoreRuntimeException: Exception occurred in action '{"amount":-1,"sort":[],"returnsCount":false,"offset":-1,"type":"RetrieveXPathSchemaRawAction","xpath":"//ActivityPlanner.DistrictCourtDays[ActivityPlanner.CourtDays_Court = '[%CurrentObject%]'][(CourtDateStart <= 1406498400000 and CourtDateEnd <= 1410127200000) or (CourtDateStart <= 1406498400000 and CourtDateEnd >= 1410127200000) or (CourtDateStart >= 1406498400000 and CourtDateEnd <= 1410127200000) or (CourtDateStart >= 1406498400000 and CourtDateEnd >= 1410127200000)]"}', all database changes executed by this action were rolled back at com.mendix.core.actionmanagement.CoreAction.processErrorState(SourceFile:342) This error only accurse when opening the page the first time. If I select another court, the corresponding courtdays are shown in the calendar. The following settings are ‘set’ in GRID 1: Selection mode = ‘Single selection Maintain’ List item Select first = Yes I have NO idea why this part is added to the X-path [(CourtDateStart <= 1406498400000 and CourtDateEnd <= 1410127200000) or (CourtDateStart <= 1406498400000 and CourtDateEnd >= 1410127200000) or (CourtDateStart >= 1406498400000 and CourtDateEnd <= 1410127200000) or (CourtDateStart >= 1406498400000 and CourtDateEnd >= 1410127200000)]
asked
2 answers
2

This is a timing issue. CurrentObject does not yet have a value when the calendar widget is rendered, resulting in the error message.

There is a work-around.

You want the rendering of the calendar widget delayed, until the CurrentObject does have a value.

To accomplish, you must place your calendar widget inside a table (1 row / 1 column). Set the visibility of the table row to conditional. Use an attribute of the entity, doesn't matter which one. Select all the possible values, including empty if your attribute is a enumeration.

If your entity does not have a boolean or enumeration value, you'll have to add a dummy attribute, just for this purpose.

Example

This workaround works because the visibility of the row can only be determined when your dataview actual has a current object. As long as it does not have a current object, the contents of your table row will not be displayed, thus preventing the error from occurring.

answered
0

Thank you Rom.

On all entity's all roles have full access (read and write).

answered