We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

How to assign DataFormItem to groups while using DataFormItemManagerExt

Hello,

I'm using subclass of DataFormItemManager and override GenerateDataFormItems for customize item of a DataForm.

How to assign items to groups? 

I have tried:

1. Assign value to Group Name. It throw exception  {System.NullReferenceException: Object reference not set to an instance of an object at Syncfusion.iOS.DataForm.DataFormItemManager.GenerateDataFormLayoutItems (Syncfusion.iOS.DataForm.DataFormItems dataFormItems, System.Int32& rowIndex) 

for example :  

 if (propertyInfo.Key == "Code")
      dataFormItem = new DataFormTextItem() { Name = propertyInfo.Key, Editor = "Text" , GroupName = "General" };

2. I suspect that the group is not exists, so i add it manually by code in the Page constructor. But it does not help.

                           DataFormGroupItem dataFormGroupItem = new DataFormGroupItem();
            dataFormGroupItem.GroupName = "General";
            dataForm.Items.Add(dataFormGroupItem);
 



2 Replies

KA Karthikraja Arumugam Syncfusion Team September 13, 2019 12:05 PM UTC

Hi Tung, 
  
Thank you for contacting Syncfusion support. 
  
We can able to reproduce the reported issue “While generating DataFormItem using DataFormItemManager class, null exception throws on change focus from DataFormItem which is inside DataFormGroupItem and logged an issue report for the same. We will fix the issue and include the issue fix in our upcoming volume 3 release which is planned to roll out at the end of September 2019. We appreciate your patience until then.  
 
You can track the status of this report through the following feedback link, 
 
  
Note: The provided feedback link is private, you need to login to view this feedback. 
 
After including the issue fix you can add DataFormItem to DataFormGroupItem and add DataFormGroupItem to DataForm ItemManager collection.  
Please refer the following code example for the same, 
  
[C#]      
  
protected override List<DataFormItemBase> GenerateDataFormItems(PropertyInfoCollection itemProperties, List<DataFormItemBase> dataFormItems) 
        { 
            var items = new List<DataFormItemBase>(); 
            DataFormGroupItem dataFormGroupItem = new DataFormGroupItem(); 
            foreach (var propertyInfo in itemProperties) 
            { 
                dataFormGroupItem.GroupName = "General"; 
                if (propertyInfo.Key == "Code") 
                    dataFormGroupItem.DataFormItems.Add(new DataFormTextItem() { Name = propertyInfo.Key, Editor = "Text", GroupName = "General" }); 
                else 
                    dataFormGroupItem.DataFormItems.Add(new DataFormTextItem() { Name = propertyInfo.Key, Editor = "Text", GroupName = "General" }); 
            } 
            items.Add(dataFormGroupItem); 
            return items; 
        } 
 
 
  
 Please let us know, if you need any further assistance. 
 
Regards,
Karthik Raja A
 



AK Ajith Kumar Senthil Kumar Syncfusion Team October 4, 2019 06:40 AM UTC

Hi Tung 
  
We are glad to announce that our Essential Studio 2019 Volume 3 Release version 17.3.0.14 is rolled out with the mentioned issue “While generating DataFormItem using DataFormItemManager class, null exception throws on change focus from DataFormItem which is inside DataFormGroupItem” and is available for download under the following link.    
 
  
Nuget link:  
  
Release notes link:  
  
We thank you for your support and appreciate your patience in waiting for this release. Please get in touch with us if you would require any further assistance.  
  
Regards,      
Ajit 


Loader.
Live Chat Icon For mobile
Up arrow icon