This is a migrated thread and some comments may be shown as answers.

Using metadata with groups

1 Answer 82 Views
DataForm
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Robert
Top achievements
Rank 1
Robert asked on 18 Jun 2017, 05:04 AM

With Angular and on iOS, when I use metadata in a form that does not have groups, I can just use:

<RadDataForm [source]="model" [metadata]="metadata"></RadDataForm>

However, if I want to use groups, I'm required to add group tags to the form:

<RadDataForm [source]="model" [metadata]="metadata">
  <TKPropertyGroup tkDataFormGroups collapsible="false" name="Stuff" hidden="false"></TKPropertyGroup>
</RadDataForm>

In my metadata, I add fields to the group like this:

{
name: "name",
displayName: "Name",
hintText: "Name",
groupName: "Main Info",
index: 0,
editor: "Text",
},

 

This does not work. I get an exception: TypeError: undefined is not an object (evaluating 'group.properties.length')

I need to add properties to the group in the XML:

<RadDataForm [source]="model" [metadata]="metadata">
  <TKPropertyGroup tkDataFormGroups collapsible="false" name="Stuff" hidden="false">
    <TKEntityProperty tkPropertyGroupProperties name="name"></TKEntityProperty>
  </TKPropertyGroup>
</RadDataForm>

 

While this works, it means I have to use a very different technique when I have groups than when I don't. Further, I have to duplicate the information about the properties in both the XML and the JSON metadata. This makes maintenance much more difficult.

It would be very, very nice if you could specify the groups in the metadata. If that isn't possible, it would be nice to be able to just specify the groups in XML and add the properties in metadata.

Finally, it would also be extremely useful if you could specify the validators in the metadata. Currently, the only way I can find to add validators to a form is with XML. I haven't figured out how to add them programmatically or with metadata.

1 Answer, 1 is accepted

Sort by
0
Nikolay Tsonev
Telerik team
answered on 19 Jun 2017, 08:32 AM
Hello,
First of all, thank you for your interest in UI for NativeScirpt.

I research the described scenario and unfortunately, I have to confirm that the setting up groupName via JSON object will not properly work and it is real problem. For your convenience, I logged new issue here, where this behavior is described. You could keep track it for further info. 

In the meantime, you could define the needed groups via the HTML as it is shown in the sample in the repository.


About the second question about defining the validators via the metadata. This is a feature there is still not implemented for the DataForm component. This also is logged in our repository and it will be implemented for some of the next versions of the plugin.

Let me know if I could help you further.
Regards,
nikolay.tsonev
Progress Telerik
Did you know that you can open private support tickets which are reviewed and answered within 24h by the same team who built the components? This is available in our UI for NativeScript Pro + Support offering.
Tags
DataForm
Asked by
Robert
Top achievements
Rank 1
Answers by
Nikolay Tsonev
Telerik team
Share this question
or