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.
Unfortunately, activation email could not send to your email. Please try again.

Data load very slow or no filtering. Need Help !

Thread ID:

Created:

Updated:

Platform:

Replies:

130713 May 28,2017 12:34 PM Jun 4,2017 11:16 PM Xamarin.Android 3
loading
Tags: SfDataGrid
Przemyslaw Kolodziejski
Asked On May 28, 2017 01:18 PM

Adds data using datatable. How to add filtering or how to speed up loading to table using eg ObservableCollection.(1 row + open activity - dt = 3sec is ok, OC = 20 sec)

Sivaraman Sivagurunathan [Syncfusion]
Replied On May 31, 2017 11:21 PM

Hi Przemyslaw Kolodziejski, 
 
Thanks for contacting Syncfusion Support. 
 
Regarding your first query(Data load very slow): 
 
We have checked your query and prepared sample for your requirement. But we are unable to reproduce the issue in our side. We have checked the loading time of SfDataGrid with 1000 rows and the grid takes 890ms in simulator and 1052ms in device. We have attached a sample for your reference and you can download the same from below link. 
 
 
Regarding your second query: 
 
We have checked your query. You can add the filtering while using DataTable as Itemsource. It can achieve by using RowFilter property. 
 
The below code illustrates how to add filtering in SfDataGrid while using DataTable. 
 
public class MainActivity : Activity 
{ 
    SfDataGrid sfGrid; 
    FilteringViewModel viewModel; 
    SearchView filterText; 
    protected override void OnCreate(Bundle bundle) 
    { 
        base.OnCreate(bundle); 
        LinearLayout linear = new LinearLayout(this); 
        linear.Orientation = Orientation.Vertical; 
        sfGrid = new SfDataGrid(this); 
        sfGrid.ColumnSizer = ColumnSizer.Star; 
        viewModel = new FilteringViewModel(this); 
        viewModel.SetRowstoGenerate(100); 
        sfGrid.ItemsSource = new GridDataTableCollectionViewExt(this.sfGrid, (IEnumerable)viewModel.DataTable.DefaultView); 
        filterText = new SearchView(this); 
        filterText.SetQueryHint("Enter the Text to filter"); 
        filterText.QueryTextChange += OnFilterTextChanged; 
        viewModel.filtertextchanged = OnFilterChanged; 
        linear.AddView(filterText); 
        linear.AddView(sfGrid); 
        SetContentView(linear); 
    } 
    void OnFilterChanged() 
    { 
        if (sfGrid.View != null) 
        { 
            var rowfilter = string.Empty; 
            for (int i = 0; i < this.sfGrid.Columns.Count; i++) 
            { 
                var colfilter = string.Empty; 
                colfilter = colfilter.Predicate(this.sfGrid.Columns[i].MappingName, filterText.Query, FilterType.Contains); 
                if (string.IsNullOrEmpty(rowfilter)) 
                    rowfilter = "(" + colfilter + ")"; 
                else 
                    rowfilter = rowfilter.OrPredicate() + "(" + colfilter + ")"; 
            } 
            (this.sfGrid.View as DataTableCollectionView).ViewSource.RowFilter = rowfilter; 
            this.sfGrid.View.RefreshFilter(); 
        } 
    } 
 
    void OnFilterTextChanged(object sender, SearchView.QueryTextChangeEventArgs e) 
    { 
        viewModel.FilterText = (sender as SearchView).Query.ToString(); 
    } 
} 
 
public class GridDataTableCollectionViewExt : GridDataTableCollectionViewWrapper 
{ 
    public GridDataTableCollectionViewExt(SfDataGrid dataGrid, IEnumerable source) 
                                            : base(source, dataGrid) 
    { 
    } 
    public override void RefreshFilter(bool isProgrammatic) 
    { 
    } 
} 
 
We have prepared sample for your requirement and have attached the sample for your reference. You can download the same from the below link. 
 
 
Regards, 
Sivaraman  
 


Przemyslaw Kolodziejski
Replied On June 1, 2017 06:02 AM

Thanks !!!
Best solution for Lenovo Yoga Book is DataTable

Sivaraman Sivagurunathan [Syncfusion]
Replied On June 4, 2017 11:16 PM

Hi Przemyslaw Kolodziejski,   
 
Thanks for the update.

Please let us know if you require further assistance on this.
 
Regards, 
Sivaraman 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;