Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to have a filtering(NSPredicate) on SSection items. #55

Open
umairsuraj opened this issue Aug 3, 2015 · 4 comments
Open

How to have a filtering(NSPredicate) on SSection items. #55

umairsuraj opened this issue Aug 3, 2015 · 4 comments

Comments

@umairsuraj
Copy link

We know that "items" inside "SSSection" is a readonly property as:

/**

  • Section items. You probably shouldn't mutate this directly;
  • instead see SSSectionedDataSource's
  • insertItem:atIndexPath:
    
  • insertItems:atIndexes:inSection:
    
    */
    @Property (nonatomic, strong, readonly) NSMutableArray *items;

So how can we use predicate on items while using SSSectionDataSource.?

@jhersh
Copy link
Member

jhersh commented Aug 3, 2015

Hi @umairsuraj, you have a few options here:

  • You could look at the (old) m.cd-filter branch to see a work-in-progress implementation of data source filtering, and build on top of that
  • You could make a subclass of SSSectionedDataSource that stores the current predicate, and when the predicate changes you can update the entries in your section and then reload the section or table
  • You could use an SSExpandingDataSource, which is already a subclass of SSSectionedDataSource and use a combination of section expanding/collapsing along with repositioning items within sections to create a filtered section

@umairsuraj
Copy link
Author

I have a look at "m.cd-filter" branch. Is this method works fine while using 'SSSectionedDataSource'?

  • (void)setCurrentFilter:(SSResultsFilter *)newFilter.

@jhersh
Copy link
Member

jhersh commented Aug 3, 2015

The cd in m.cd-filter refers to Core Data, and this branch was initially only for SSCoreDataSource. It is definitely an old work in progress; you'd have to port those features to the sectioned data source.

@umairsuraj
Copy link
Author

Sure. Thanks. I will port them in sectioned data source. But including filtering methods inside will be very helpful for all of us, who are preferring your library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants