UA-17470720-3

Jump to content


Photo
- - - - -

How to filter tables with search bar and parse.com ?

web-services models

  • Please log in to reply
2 replies to this topic

#1 fabiensen

fabiensen

    Jr. Member

  • STV 4.0 Std
  • PipPip
  • 23 posts
Reputation: 5
Good

Posted 09 April 2015 - 05:49 AM

Hi!

 

that's Fabio, one of the testimonials by the way :)

 

Today I started the integration with parse.com. It seems very promising. However, I have no idea how to handle a search bar in the table view (let's say the tasks table of the example) which could filter the list. What if I'd like to search for tasks only with a specific name?

I could do it in Core Data, but with Parse I have no idea. Any webpage or tutorial to start? 

 

Thank you very much

Fabio



#2 Tarek

Tarek

    Forum Admin

  • Administrators
  • 3670 posts
Reputation: 452
Popular

Posted 09 April 2015 - 07:29 AM

Hi Fabio, of course I remember you :)

 

STV provides automatic search functionality no matter what your data source is. You just need to have STV use an SCArrayOfObjectsModel instead of its default SCTableViewModel, then configure the SCArrayOfObjectsModel with all your search requirements. Here is a code sample that adds automatic search to our ParseApp bundled sample:

 

- (void)viewDidLoad
{
    [super viewDidLoad];
    
    SCArrayOfObjectsModel *objectsModel = [[SCArrayOfObjectsModel alloc] initWithTableView:self.tableView];
    objectsModel.enableSearchController = YES;  // enable automatic search
    self.tableViewModel = objectsModel;  // tell STV to use our SCArrayOfObjectsModel instead of its default SCTableViewModel
}

 

Furthermore, you can fine tune exactly what property name(s) to search by setting the objectsModel's searchPropertyName (it's already set by default to the very first property name in your data definition). Also, you can completely customize the computed search results by implementing modelActions.didComputeSearchResults.

 

Please let me know if you need any more help with this.



#3 fabiensen

fabiensen

    Jr. Member

  • STV 4.0 Std
  • PipPip
  • 23 posts
Reputation: 5
Good

Posted 10 April 2015 - 12:52 AM

Hi Tarek,

 

you are the one! :) Thank you very much, it is working like a charm!

 

Thanks again!

Warm regards

 

Fabio Ricci







Also tagged with one or more of these keywords: web-services, models

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users