- Home
- Forum
- Xamarin.Forms
- SfDataGrid inside SfPullToRefresh can not horizontal scroll when have a little rows data (1 -> 5 rows).
SfDataGrid inside SfPullToRefresh can not horizontal scroll when have a little rows data (1 -> 5 rows).
Hi Syncfusion,
I have a problem when using SfPullToRefresh with Content is SfDataGrid. I can not scroll, very lag.
Here my out put:
[Choreographer] Skipped 96 frames! The application may be doing too much work on its main thread.
[nyname.griddem] Explicit concurrent copying GC freed 4560(367KB) AllocSpace objects, 0(0B) LOS objects, 49% free, 4748KB/9497KB, paused 351us total 12.694ms
[nyname.griddem] Explicit concurrent copying GC freed 3865(176KB) AllocSpace objects, 0(0B) LOS objects, 49% free, 4860KB/9720KB, paused 331us total 12.398ms
[nyname.griddem] Explicit concurrent copying GC freed 3477(151KB) AllocSpace objects, 0(0B) LOS objects, 49% free, 4980KB/9961KB, paused 338us total 12.671ms
[nyname.griddem] Explicit concurrent copying GC freed 3108(126KB) AllocSpace objects, 0(0B) LOS objects, 49% free, 5110KB/10220KB, paused 330us total 13.058ms
[nyname.griddem] Explicit concurrent copying GC freed 3897(186KB) AllocSpace objects, 0(0B) LOS objects, 49% free, 5227KB/10MB, paused 336us total 13.566ms
Demo in my attachment.
Thanks
Attachment: GridDemo_a8b439e6.zip
In addition, I have a problem when using Navigation.PushAsync a page with content is a SfDataGrid and SfDataGrid is being end horizontal scroll state.
Steps test:
Step 1. After app loading, clicking button to show Page have Grid. After that, scroll horizontal to column end.
Step 2. Pressed Back button
Step 3. Clicking button to show Page again.
=> Grid error like this photo:
Demo in my attachment.
Thanks
Thank you for contacting Syncfusion support.
We are able to reproduce the reported issue "Horizontal Scrolling getting lag when loading SfDataGrid as PullableContent of SfPullToRefresh". Currently, we are analyzing the issue with our source. We will update the details for this issue on or before 31st August 2021. We appreciate your patience until then.
Regarding the "Row's are not appearing when navigating back to the previous page and comes to Datagrid page", We would like to let you know that you have created a Datagrid containing page instance at only one time, and by using that created instance you had navigated back to Datagrid page. So, in this case, the Row's are not properly layout on the page. So, we suggest you dispose of the Datagrid on OnDisappearing method of the page and create a new instance for DataGrid on OnAppearing method of the page like the below code snippets.
Code snippets :
|
public class GridPage : ContentPage
{
SfDataGrid grid;
SfPullToRefresh refresh;
public GridPage()
{
grid= new SfDataGrid
{
AllowLoadMore = false,
AutoGenerateColumns = false,
AllowResizingColumn = true,
ResizingMode = ResizingMode.OnTouchUp,
ColumnSizer = ColumnSizer.SizeToHeader,
ScrollingMode = ScrollingMode.Pixel,
VerticalOverScrollMode = VerticalOverScrollMode.None,
AllowDiagonalScrolling = false,
EnableDataVirtualization = true,
RowHeight = 40,
HeaderRowHeight = 40,
SelectionMode = Syncfusion.SfDataGrid.XForms.SelectionMode.SingleDeselect,
DefaultColumnWidth = 150,
};
refresh = new SfPullToRefresh();
//refresh.PullableContent = grid;
refresh.Refreshing += OnRefresh;
grid.BackgroundColor = Color.Yellow;
grid.HorizontalOptions = grid.VerticalOptions = LayoutOptions.FillAndExpand;
grid.ItemsSource = GetSource();
for (int i = 1; i < 11; i++)
AddColumn($"P{i}", $"Property {i}");
Content = grid;
}
private async void OnRefresh(object sender, EventArgs e)
{
refresh.IsRefreshing = true;
await Task.Delay(100);
refresh.IsRefreshing = false;
}
protected async override void OnAppearing()
{
base.OnAppearing();
if (grid== null)
{
grid = new SfDataGrid
{
AllowLoadMore = false,
AutoGenerateColumns = false,
AllowResizingColumn = true,
ResizingMode = ResizingMode.OnTouchUp,
ColumnSizer = ColumnSizer.SizeToHeader,
ScrollingMode = ScrollingMode.Pixel,
VerticalOverScrollMode = VerticalOverScrollMode.None,
AllowDiagonalScrolling = false,
EnableDataVirtualization = true,
RowHeight = 40,
HeaderRowHeight = 40,
SelectionMode = Syncfusion.SfDataGrid.XForms.SelectionMode.SingleDeselect,
DefaultColumnWidth = 150,
};
grid.BackgroundColor = Color.Yellow;
grid.HorizontalOptions = grid.VerticalOptions = LayoutOptions.FillAndExpand;
grid.ItemsSource = GetSource();
for (int i = 1; i < 11; i++)
AddColumn($"P{i}", $"Property {i}");
this.Content = grid;
this.ForceLayout();
}
}
protected override void OnDisappearing()
{
base.OnDisappearing();
grid.ItemsSource = null;
grid.Dispose();
grid = null;
this.Content = null;
}
public ObservableCollection<Model> GetSource()
{
var size = new Random().Next(1, 5);
var result = new ObservableCollection<Model>();
for (int i = 0; i < size; i++)
result.Add(new Model($"Value {i}", $"Value {i}", $"Value {i}", $"Value {i}", $"Value {i}", $"Value {i}", $"Value {i}", $"Value {i}", $"Value {i}", $"Value {i}"));
return result;
}
public void AddColumn(string mapping, string header)
{
grid.Columns.Add(new TextColumn(mapping, header));
}
} |
Regards,
Karthik Raja
Hi,
Thanks for your reply.
Regarding the "Row's are not appearing when navigating back to the previous page and comes to Datagrid page",
Is there a good solution?
My Grid Page is designed to reuse much times, I can not set Grid to null. I want save last user state and I want show old Page without dispose grid object.
Any another solution for that?
Thanks
Thanks for the update.
We are able to understand what you are trying to achieve and found a suitable workaround to overcome the issue. Please ForceLayout the scrollview after the page loaded. For more details, please refer to the below code snippets.
Code snippets :
|
public class GridPage : ContentPage
{ ...... protected async override void OnAppearing() {
base.OnAppearing();
await Task.Delay(100);
this.grid.GetVisualContainer().AndroidScrollOwner.ForceLayout();
} ... |
Regards,
Karthik Raja
It work for me on Android. But, how about IOS? Thanks.
Now, Im waiting Syncfusion to fix Scroll lag.
Thanks.
Thanks for the update.
Currently, we are validating the issue with our source. So, we will update further details on or before 3rd Sept 2021. We appreciate your patience until then.
Regards,
Karthik Raja
Sorry for the inconvenience caused.
We need some more time to analyze the issue with source level. So, we will update the further details on or before 8th September 2021. We appreciate your patience until then.
Regards,
Karthik Raja
Sorry for the inconvenience caused.
We need some more time to analyze the issue, due to its complexity. We will update further details on or before 13th September 2021. We appreciate your patience until then.
Regards,
Karthik Raja
Im waiting every day. Please fix this issue. I think that is a big issue and very difficult to know where is the bug.
Sorry for the inconvenience caused.
We understand your situation and would like to inform you of this. We discovered the root cause of this issue, which occurs in the SfDataGrid control. So, currently we are analyzing the issue in source level. So, we will update the further details on or before 13th September 2021. We appreciate your patience and understanding.
Regards,
Karthik Raja
Hi Nguyen,
We have forwarded to development team to validate the issue . We will update with further details on 15th september 2021. We appreciate your patience and understanding.
Regards,
Karthik Raj
I need a lastest day to report with my customer.
End of this month or End of this year?
Thanks.
Thanks you. It work fine with demo source. I will check it on my product.
It it very difficulty to determine the cause of error. But you well done.
Thanks
- 18 Replies
- 4 Participants
-
NK Nguyen Khoa Lu
- Aug 26, 2021 03:14 PM UTC
- Oct 21, 2021 06:55 AM UTC