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

Filtering with LoadMoreItems option

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.

1 Reply

SP Subburaj Pandian Veluchamy Syncfusion Team 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  
 


Loader.
Up arrow icon