Paging issues with frontend filtering of Dynamic Content Typ

Posted by Community Admin on 05-Aug-2018 11:04

Paging issues with frontend filtering of Dynamic Content Type

All Replies

Posted by Community Admin on 16-Oct-2014 00:00

I have created a module using the Module Builder and have added frontend filtering to the list of items exactly as this sitefinity blog post describes. The frontend filtering is working just fine however the built-in paging does not function correctly when any sort of filtering gets applied.

By built-in paging I mean going to backend, then going to the page where the widget has been placed, then clicking on widget edit, going to "list settings" then selecting the "use paging" radio button. The paging will work as expected until you decide to do some filtering. For example, using the "Offices" module as described in the linked post above, if you were to search for a particular City that wasn't on the first page, it won't be returned.

I believe the problem is the way the DataSource is obtained in the "SearchButton_Click" event handler (see blog post). By that I mean I think when paging is used, the retrieved DataSource when filtering only contains the items on the current page. To show how the data source is obtained, I've included the "SearchButton_Click" method from the blog post example below:

void SearchButton_Click(object sender, EventArgs e)
        
            var dataSource = ((IEnumerable<DynamicContent>)this.DynamicContentListView.DataSource);
            if (!this.CityTextBox.Text.IsNullOrEmpty())
                dataSource = dataSource.Where(itm => itm.GetValue(cityFieldName).ToString().Contains(CityTextBox.Text));
  
            if (!this.CountryTextBox.Text.IsNullOrEmpty())
                dataSource = dataSource.Where(itm => itm.GetValue(countryFieldName).ToString().Contains(CountryTextBox.Text));
                 
            if (!this.ZipCodeTextBox.Text.IsNullOrEmpty())
                   dataSource = dataSource.Where(itm => itm.GetValue(zipFieldName).ToString().Contains(ZipCodeTextBox.Text));
  
            this.DynamicContentListView.DataSource = dataSource.ToList();
        

 Does anyone know how to get the paging to work with custom frontend filtering? (or vice-versa)

Posted by Community Admin on 21-Oct-2014 00:00

Hello Gavin,

I have answer you in the support ticket.

Once you have the solution, you can share it with the community.

Regards,
Svetoslav Manchev
Telerik

 
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
 

This thread is closed