UA-17470720-3

Jump to content


Photo
- - - - -

Delegate for addNewObjectuiElement? (STV 2.1 beta 2)


  • Please log in to reply
27 replies to this topic

#1 Julian G.

Julian G.

    Sr. Member

  • STV 2.0
  • PipPipPip
  • 47 posts
Reputation: 2
Good

Posted 05 July 2011 - 04:43 AM

Hi guys,

is it possible to get the add new item event of a SCPropertyTypeArrayOfObjects for customizing?

If want to show an available list of objects. (many-to-many relationship)


best regards,
gemuese

#2 Tarek

Tarek

    Forum Admin

  • Administrators
  • 3670 posts
Reputation: 452
Popular

Posted 05 July 2011 - 06:37 AM

Hi Julian,

To get notified when a new item is added to an SCArrayOfObjectsSection, just implement the SCTableViewModelDelegate method called 'tableViewModel:itemAddedForSectionAtIndexPath:item:'.

Hope this helps.

#3 Julian G.

Julian G.

    Sr. Member

  • STV 2.0
  • PipPipPip
  • 47 posts
Reputation: 2
Good

Posted 05 July 2011 - 06:50 AM

It could help me, if i could supress the add dialog, which opens on clicking the add cell.

Is it possible?

#4 Tarek

Tarek

    Forum Admin

  • Administrators
  • 3670 posts
Reputation: 452
Popular

Posted 05 July 2011 - 07:11 AM

Would you please explain to me exactly what you want to do/display when the Add New Item cell is tapped? Odds are STV can do that for you without much customization. Thanks!

#5 Julian G.

Julian G.

    Sr. Member

  • STV 2.0
  • PipPipPip
  • 47 posts
Reputation: 2
Good

Posted 05 July 2011 - 07:21 AM

ok,

i have the following classes: Contact, ContactToContactPerson, ContactPerson.

if i edit a contact i want show all contact persons related to a contact expanded in the contact edit view. To add a contact i have to show a list of available contact persons and create a relation object.

I think this is possible with SCPropertyTypeObjectSection, but the objects cannot be expanded in the contact view.

i hope i could clarify my problem.

Thanks!
gemuese

#6 Tarek

Tarek

    Forum Admin

  • Administrators
  • 3670 posts
Reputation: 452
Popular

Posted 06 July 2011 - 10:24 PM

Hi Julian,

Yes, this can be done using SCPropertyTypeObjectSelection, but I still can't figure out the relationship between this and overriding the add new object view?

Anyways, you can easily override what happens when you tap the "Add" button by setting it's 'action' property to any of your custom methods, instead of having STV take over when it's tapped. Hope this helps.

#7 Julian G.

Julian G.

    Sr. Member

  • STV 2.0
  • PipPipPip
  • 47 posts
Reputation: 2
Good

Posted 11 July 2011 - 07:20 AM

Hi tarek,

the main problem is, that the Object selection displays all selected items in one cell. And i didn't see a way to display the object selection cell as a section.
Is it possible to add this as a new feature?!

Otherwise i have to use overwrite the add button.

best regards
gemuse

#8 Julian G.

Julian G.

    Sr. Member

  • STV 2.0
  • PipPipPip
  • 47 posts
Reputation: 2
Good

Posted 13 July 2011 - 08:36 AM

Hi again,

i found the SCObjectSelectionSection, so i think it is possible to display many-to-many assingments in a seperate section, right?

i tried to use the expandContentInCurrentView property to show the assignments from a many-to-many relationship but nothing is displayed.

Here the code:
SCClassDefinition *productlineClassDef = [SCClassDefinition definitionWithClass:[FACTS_ContactToProductline class] withPropertyNames:[NSArray arrayWithObject:@"name"]];
	
SCPropertyDefinition *productlinePropertyDef = [contactClassDef propertyDefinitionWithName:@"toProductlineArray"];

productlinePropertyDef.type = SCPropertyTypeObjectSelection;
	
SCObjectSelectionAttributes *productlineAttributes = [SCObjectSelectionAttributes attributesWithItemsEntityClassDefinition:productlineClassDef allowMultipleSelection:YES allowNoSelection:YES];
	
productlineAttributes.expandContentInCurrentView = YES;
productlinePropertyDef.attributes = productlineAttributes;

thank you for your help
gemuese

#9 Tarek

Tarek

    Forum Admin

  • Administrators
  • 3670 posts
Reputation: 452
Popular

Posted 13 July 2011 - 10:07 AM

Hi gemuese,

Thanks a lot for all your feedback. We're now working really hard on adding this feature out-of-the-box for you before the final 2.1 release. You should be able to have it for testing early next week, I'll keep you updated. Thanks again :)

#10 Julian G.

Julian G.

    Sr. Member

  • STV 2.0
  • PipPipPip
  • 47 posts
Reputation: 2
Good

Posted 13 July 2011 - 12:00 PM

That would be great! Thank you!

#11 Julian G.

Julian G.

    Sr. Member

  • STV 2.0
  • PipPipPip
  • 47 posts
Reputation: 2
Good

Posted 17 August 2011 - 07:13 AM

Hi,

in the coredatasample app i try to make the category attribute (contained in task) to a many-to-many relationship and set allowMultipleSelection = YES.

The result is, that the detail view will not open.

i tried the same without the core data and have the same problem.

I'm using STV 2.1.1

#12 Tarek

Tarek

    Forum Admin

  • Administrators
  • 3670 posts
Reputation: 452
Popular

Posted 17 August 2011 - 01:20 PM

Hi gemuese,

Are you sure the Core Data model was updated correctly? Would you kindly email me the sample project you modified? Thank you very much.

#13 Tarek

Tarek

    Forum Admin

  • Administrators
  • 3670 posts
Reputation: 452
Popular

Posted 19 August 2011 - 10:10 PM

Thanks for sending in your project Julian. You actually have some weird characters in the task class definition initializer. Please replace you initializer with the following code and it should work:

SCClassDefinition *taskDef = [SCClassDefinition definitionWithEntityName:@"TaskEntity" withManagedObjectContext:managedObjectContext withPropertyNames: [NSArray arrayWithObjects:@"name", @"desc", @"dueDate", @"active", @"priority", @"categories", @"assignedTo", @"taskSteps", nil]];

Hope this helps.

#14 Julian G.

Julian G.

    Sr. Member

  • STV 2.0
  • PipPipPip
  • 47 posts
Reputation: 2
Good

Posted 22 August 2011 - 05:03 AM

Hi,

i've tried it but it doesn't work.
Also, i cannot see any difference between the sended code and the snipped from you...

#15 Tarek

Tarek

    Forum Admin

  • Administrators
  • 3670 posts
Reputation: 452
Popular

Posted 22 August 2011 - 11:50 AM

Hi Julain,

It seems that you need to do a clean build. Also, please find attached the TasksViewController.m file that is working at my side. Please tell me if your project works after doing a clean build.

#16 Julian G.

Julian G.

    Sr. Member

  • STV 2.0
  • PipPipPip
  • 47 posts
Reputation: 2
Good

Posted 26 August 2011 - 09:57 AM

hi again,

no difference!

I have assignedTo and categories in the table view, but it does nothing by clicking on it!

The aim is to show up a objectselectioncell expanded in a seperate section. With a button at the end to change the assignment. ( many-to-many relationship )

thanks for help!
gemuese

#17 Tarek

Tarek

    Forum Admin

  • Administrators
  • 3670 posts
Reputation: 452
Popular

Posted 26 August 2011 - 09:36 PM

Hi gemuese,

This is super strange! I'll email you now the whole project which is working perfectly on my side. It is needless to say that since that Task required editing mode to be edited, you should tap the 'Edit' button before tapping on the 'Categories' cell.

Please tell me if this works.

#18 Julian G.

Julian G.

    Sr. Member

  • STV 2.0
  • PipPipPip
  • 47 posts
Reputation: 2
Good

Posted 30 August 2011 - 04:44 AM

Hi Tarek,

sorry that was my fault. I forgot to click the edit button. :-/
But if i try:

selectionAttribs.expandContentInCurrentView = YES;

the cell won't be displayed...


thank you for your help

#19 Tarek

Tarek

    Forum Admin

  • Administrators
  • 3670 posts
Reputation: 452
Popular

Posted 02 September 2011 - 02:12 AM

Hi gemuese,

This should be working in our STV 2.1.2 release, due in about 48 hours. Thank you very much for all your feedback.

#20 Julian G.

Julian G.

    Sr. Member

  • STV 2.0
  • PipPipPip
  • 47 posts
Reputation: 2
Good

Posted 05 September 2011 - 05:39 AM

Hey Tarek,

i've looked at it and it seems to be a little bit wrong implemented.

Now, if i try extendInCurrentView, i got the whole list of categories and can add and delete them. But it's more complicated because with a many-to-many relationship you have to assign the categories.

i would suggest a section with all assigned categories in the task view. In addition to the assigned items a button that opens a view to change the assignment and edit/add/delete functionality, if not read-only.

What do you think about that?


best regards,
julian




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users