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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Filtering with LoadMoreItems option

Thread ID:

Created:

Updated:

Platform:

Replies:

143784 Apr 4,2019 05:39 PM UTC Apr 5,2019 01:35 PM UTC Xamarin.Forms 1
loading
Tags: SfDataGrid
Mario
Asked On April 4, 2019 05:42 PM UTC

Hi guys,

I have a SfDataGrid with AllowLoadMore set to true and my LoadMoreCommand is wired into my View Model that performs on demand loading from the server. 

I also have a SearchBar implemented which currently only filters on the current loaded items in my grid - and that works fine. My requirement is to search on the server via a Rest call given the filter text value and return the items that match.

All your examples work on the in memory ItemsSource of the grid when searching I would like an example given the requirement above.

Subburaj Pandian Veluchamy [Syncfusion]
Replied On April 5, 2019 01:35 PM UTC

Hi Mario, 
  
Thank you for contacting Syncfusion support. 
  
We have checked your query “How to add filtered records through load more command” in Xamarin Forms, for this you need to get all the records from the service and filter the records based on your predicate and add the filtered records to dataGrid underlying collection. In our example we have fetched the data from the collection based on the search bar text. Please refer the following code, 
  
[C#] 
internal void LoadMoreItems(string searchbarText) 
{ 
    if (searchbarText is string && searchbarText != "") 
    { 
        foreach (var item in OrdersInfo) 
        { 
            if (item.CustomerID.ToLower().Contains(searchbarText.ToLower())) 
                dataGridCollection.Add(item); 
        } 
    } 
    else 
    { 
        var collection = OrdersInfo.Skip(20).Take(30); 
        foreach (var item in collection) 
        { 
            dataGridCollection.Add(item); 
        } 
    }          
} 
  
We have attached the sample for your reference, 
 
 
We hope this helps. Please let us know, if you need any further assistance.  
  
Regards,
Subburaj Pandian V  
 


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon 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.Close Icon

Live Chat Icon For mobile
Live Chat Icon