DataGrid seems not applying Date formatting for KeyValueEntity

Hi

Attached a sample project where CustomerOrder browser displays the list of orders in 3 different ways:

  • a table with a regular collection datasource
  • a grid with the same data source
  • a grid with a KeyValueEntity collection datasource copying order properties

The KeyValueMetaClass is copying its MetaProperties from CustomerOrder meta class so they have the same type.

You can see that in the 3rd grid with KV data source, the number format is applied, but not the Date format whereas in the 2 other cases it is.

image

Michael

kvdategrid.zip (116.3 KB)

Hi, @michael.renaud!

The problem isn’t related to DataGrid, Table shows the same values in case of using your CustomValueCollectionDatasource implementation. The reason is that you don’t take into account the Datatype of attributes while adding them to ExtKeyValueMetaClass (which is as far as I can see the extension over the default KeyValueMetaClass). Normally when adding VCDs properties in XML, you will write something like this:

<valueCollectionDatasource id="someVCDs">
    <properties>
        <property name="date1" datatype="date"/>
        <property name="date2" datatype="dateTime"/>
    </properties>
</valueCollectionDatasource>

So, the datatype indicates that date1 must be formatted without a time and date2 including time.

Regards,
Gleb

I did modify ExtKeyValueMetaClass to take Datatype into account and it works as intended.

Thanks @gorelov !