RadDataForm: Groups

If you followed the getting started article, you now know how to edit an object's properties with DataForm for NativeScript. If your business object contains a lot of properties, it may be useful to show them in groups and optionally allow them to be collapsed. This article explains how.

NativeScriptUI-DataForm-Groups-Android NativeScriptUI-DataForm-Groups-iOS

Adding groups

Adding groups to the data form and specifying which property belongs to each group is done very intuitively with the xml. Instead of adding properties to the data form directly, we add groups to the data form and properties to the groups, Here's how:

<df:RadDataForm id="myDataForm" source="{{ person }}" >

    <df:PropertyGroup collapsible="true" name="Main Info" hidden="false" >
            <df:EntityProperty name="name" >
                    <df:PropertyEditor type="Text" />

Note the collapsible property of the PropertyGroup. This allows you to specify whether the groups can be collapsed by tapping on their header. If you want to hide the whole header, you can use PropertyGroup's titleHidden property. If you need to make changes to some of the properties of the PropertyGroup, you can use the getGroupByName and make your changes:

export function changeGroupLabelTextColor() {
    var group = dataform.getGroupByName("Main Info");
    group.titleStyle.labelTextColor = "Blue";


RadDataForm provides events to notify you when a group is collapsed or expanded, if the group supports collapsing. The event names are groupExpanded and groupCollapsed. Both events provide event arguments which have a property groupName which you can use to determine the name of the group that was collapsed/expanded.


Want to see this scenario in action?
Check our SDK examples repo on GitHub. You will find this and many other practical examples with NativeScript UI.

Related articles you might find useful: