sfdatagrid inside a sfpopup

Good morning, I am trying to load a sfdatagrid into a sfpopup, but doing so freezes the application. I did a test loading a sflistview and had no problems. I am not using MVVM






5 Replies 1 reply marked as answer

KK Karthikraja Kalaimani Syncfusion Team August 5, 2020 01:43 PM UTC

Hi David,

Based on the provided details we created the sample and we saw that the popup takes maximum of 5 to 10s to open with SfDataGrid. And the second time the popup is opened immediately. So could you please confirm whether you are facing the same behavior from your side or not ?. If not please let us know the below details.

i) SfdataGrid and SfPopupLayout version
ii) Xamarin Forms version
iii) How many rows in SfDatagrid
iv) how you open the popup via button click or OnAppearing of the page ?

Regards,
Karthik Raja
 



DA David August 5, 2020 06:11 PM UTC

i) SfdataGrid and SfPopupLayout version = 18.2.0.46
ii) Xamarin Forms version = 4.3.0.991211
iii) How many rows in SfDatagrid = 5
iv) how you open the popup via button click or OnAppearing of the page = Button

Thanks for the prompt attention, I can already visualize the datagrid, but I have problems with:

popupLayout.PopupView.AutoSizeMode = AutoSizeMode.Both;

only the column headings are visible but not the data  (7 records should appear).




if I don't use it the records are seen but the last column is not complete and it has to be dragged to be able to see it, so I tried to use the autosizemode but it doesn't work.


KK Karthikraja Kalaimani Syncfusion Team August 6, 2020 01:12 PM UTC

Hi David,

We have checked the reported issue “Row headers only shown” when setting AutoSize as both in the Android platform. We found that while measuring the SfDataGrid it returns height as inconsistently from the framework level. So, the incorrect height sets to the popup view at every first time. To overcome this behavior, set the height and width for Datagrid by manually or call the Refresh method of the PopupView in the opening event of the popupview. And this method only for recalculate the height, width, and position of the PopupView. For more details please refer to the below code snippet.

Code snippet :
 
 
SfPopupLayout sfPopup; 
        SfDataGrid sfdatagrid; 
        DataTemplate template; 
        bool isopening = false; 
             public MainPage() 
             { 
            InitializeComponent(); 
            sfPopup = new SfPopupLayout(); 
            sfdatagrid = new SfDataGrid(); 
            isopening = true; 
            sfdatagrid.ColumnSizer = ColumnSizer.Auto; 
            sfdatagrid.AutoGenerateColumns = false; 
            sfdatagrid.ItemsSource = viewModel.OrdersInfo; 
            sfPopup.PopupView.ShowFooter = false; 
            sfPopup.PopupView.AnimationMode = AnimationMode.Zoom; 
            sfPopup.PopupView.HeaderTitle = "Lista de Expedientes"; 
            sfPopup.PopupView.AutoSizeMode = AutoSizeMode.Both; 
            sfPopup.Opening += SfPopup_Opening; 
            StackLayout stackLayout = new StackLayout(); 
            Label label = new Label(); 
            label.Text = "Label"; 
            GridTextColumn gridTextColumn = new GridTextColumn(); 
            gridTextColumn.MappingName = "OrderID"; 
            sfdatagrid.Columns.Add(gridTextColumn); 
            GridTextColumn gridTextColumn2 = new GridTextColumn(); 
            gridTextColumn2.MappingName = "EmployeeID"; 
            sfdatagrid.Columns.Add(gridTextColumn2); 
            GridTextColumn gridTextColumn3 = new GridTextColumn(); 
            gridTextColumn3.MappingName = "CustomerID"; 
            sfdatagrid.Columns.Add(gridTextColumn3); 
            GridTextColumn gridTextColumn4 = new GridTextColumn(); 
            gridTextColumn4.MappingName = "FirstName"; 
            sfdatagrid.Columns.Add(gridTextColumn4); 
            GridTextColumn gridTextColumn5 = new GridTextColumn(); 
            gridTextColumn5.MappingName = "LastName"; 
            sfdatagrid.Columns.Add(gridTextColumn5); 
            stackLayout.Children.Add(label); 
            stackLayout.Children.Add(sfdatagrid); 
            sfPopup.PopupView.ContentTemplate = new DataTemplate(() => { 
 
               return stackLayout; 
           }); 
        } 
 
        private void SfPopup_Opening(object sender, Syncfusion.XForms.Core.CancelEventArgs e) 
        { 
            if (isopening) 
            { 
                sfPopup.PopupView.Refresh(); 
            } 
            isopening = false; 
        } 
 
        private void Button_Clicked_2(object sender, EventArgs e) 
        { 
            sfPopup.Show(); 
        } 
    } 


Regarding “Application freeze when open popupview with sfDatagrid” we suspect that GC gets collecting after the button click. So, only the application is freeze. So, could you please check the Output window whether or not GC collects and let us know the details.

Regards,
Karthik Raja
 


Marked as answer

DA David August 6, 2020 04:50 PM UTC

Thank you very much!! The size of the popup was corrected, with respect to the freezing it occurred because there was a column without a binding. Sorry and thanks for the prompt help.


SS Sivaraman Sivagurunathan Syncfusion Team August 7, 2020 11:05 AM UTC

  
Hi David, 
 
We are happy to hear from you. Please get in touch with us if you would require any further assistance.  
 
Regards, 
Sivaraman S 


Loader.
Up arrow icon