Welcome, Guest
Username Password: Remember me

SCPropertyTypeObjectSelection
(1 viewing) (1) Guest
  • Page:
  • 1
  • 2

TOPIC: SCPropertyTypeObjectSelection

SCPropertyTypeObjectSelection 1 year, 5 months ago #1

Hi,

I have setup my propertyDefinition as type SCPropertyTypeObjectSelection and based on a ClassDefinition as follows :

 
SCClassDefinition *subAreaClassDef =
[SCClassDefinition definitionWithEntityName:@"SubAreaType" withManagedObjectContext:managedObjectContext
withPropertyNames:[NSArray arrayWithObjects:@"name", nil]];
 
SCPropertyDefinition *subInspectionAreaPropertyDef = [subInspectionAreaClassDef propertyDefinitionWithName:@"subArea"];
subInspectionAreaPropertyDef.type = SCPropertyTypeObjectSelection;
subInspectionAreaPropertyDef.attributes = [SCObjectSelectionAttributes attributesWithItemsEntityClassDefinition:subAreaClassDef withItemsTitlePropertyName:@"name" allowMultipleSelection:NO allowNoSelection:NO];
 


When that cell is displayed however via detailViewWillAppearForCell, I want to be able to filter the rows returned for the user, from that SubAreaType CoreData table. Is this possible somehow ? ? Thanks
  • monsta
  • OFFLINE
  • Expert Boarder
  • Posts: 130
  • Karma: 2

Re: SCPropertyTypeObjectSelection 1 year, 5 months ago #2

Hi Phil,

This is actually scheduled for our next release, and will be added to the beta version (just released here: www.sensiblecocoa.com/forum/announcement...0-beta-released.html) in about a week from now. Thanks!
  • tarekskr
  • OFFLINE
  • Administrator
  • Posts: 2402
  • Karma: 72

Re: SCPropertyTypeObjectSelection 1 year, 5 months ago #3

Ok thanks. Is the Beta available for public release yet or will that be in a few weeks ?
  • monsta
  • OFFLINE
  • Expert Boarder
  • Posts: 130
  • Karma: 2

Re: SCPropertyTypeObjectSelection 1 year, 5 months ago #4

Hi Phil,

We've added a new property to SCObjectSelectionAttributes called "itemsPredicate". All you need to filter the selection items now is set this property to a valid NSPredicate instance. Please tell me if this works well for you.

The new property is part of our STV 2.0 beta2 release, which I've just sent you a copy of.
  • tarekskr
  • OFFLINE
  • Administrator
  • Posts: 2402
  • Karma: 72

Re: SCPropertyTypeObjectSelection 1 year, 1 month ago #5

Hi Tarek,

Is it possible to get access or set the predicate dynamically against the SCObjectSelectionAttributes and not when the class and property definitions are initially created ? Or do you have an example of its use ?

I have a list of subAreas, and the predicate is based on the current inspection area i.e.
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"forArea=%@", inspectionArea];
 

, which can only be evaluated at runtime.

Thanks
  • monsta
  • OFFLINE
  • Expert Boarder
  • Posts: 130
  • Karma: 2

Re: SCPropertyTypeObjectSelection 1 year, 1 month ago #6

Hi Phil,

At runtime, you can just fetch the objects array yourself and assign them to SCObjectSelectionCell.items

Please tell me if this works well for you.
  • tarekskr
  • OFFLINE
  • Administrator
  • Posts: 2402
  • Karma: 72
  • Page:
  • 1
  • 2
Time to create page: 1.71 seconds