Reputation: 5018
I have a SAPUI5 smart table and I used the following way for defining the custom column of type date
.
In my oData I have two columns like this:
<Property Name="Datum" Type="Edm.DateTime" sap:creatable="true" sap:updatable="true" sap:deletable="true" sap:display-format="Date" sap:label="Datum"/>
<Property Name="AngebotAngefragt" Type="Edm.DateTime" sap:creatable="true" sap:updatable="true" sap:deletable="true" sap:display-format="Date" sap:label="AngebotAngefragt"/>
I defined one of them as a custom column like the following:
<Column visible="true">
<customData>
<core:CustomData key="p13nData" value='{"columnKey": "Datum", "leadingProperty": "Datum", "sortProperty": "Datum", "filterProperty": "Datum", "columnIndex":"3", "type": "date"}'/>
</customData>
<Text text="{/#Meldungen/Datum/@sap:label}"/>
</Column>
In the older version of UI5, with same snippet of code, it showed a calendar for the custom item in p13n
dialog when we set the type to date
, but now I use version 1.80
and it shows an input box instead.
Here is what it shows for the the Datum
column:
And here is what it shows for AngebotAngefragt
column that I haven't defined as a custom column:
Upvotes: 1
Views: 2001
Reputation: 26
This can be solved by this syntax:
<Column visible="true">
<customData>
<core:CustomData key="p13nData" value='\{"columnKey": "Datum", "leadingProperty": "Datum", "sortProperty": "Datum", "filterProperty": "Datum", "columnIndex":"3", "type": "date"}'/>
</customData>
<Text text="{/#Meldungen/Datum/@sap:label}"/>
</Column>
What really does the trick here, is the leading backslash in property value.
Without giving the backslash at the beginning in the Columns customData Definition (on js level) there will be a property type added, but with value undefined. Should have something to do with the internal handling of SAPUI5 (and the String not being escaped), but however this is not explicitly documented.
Code Example: https://sapui5.netweaver.ondemand.com/#/topic/bed8274140d04fc0b9bcb2db42d8bac2 (FAQ -> 1. Example Snippet)
Upvotes: 1