UA-17470720-3

Jump to content


Photo
- - - - -

how to do a checkbox for multiple cell selection for a particular action?

sections cells

  • Please log in to reply
2 replies to this topic

#1 Balachandhar

Balachandhar

    Experienced Member

  • STV 3.0 Pro
  • PipPipPipPip
  • 87 posts
Reputation: 21
Excellent

Posted 30 April 2014 - 11:24 AM

I would like to update/delete the selected rows alone, is it possible? if yes can you guide me to achieve the same?

 

thanks

bala



#2 Balachandhar

Balachandhar

    Experienced Member

  • STV 3.0 Pro
  • PipPipPipPip
  • 87 posts
Reputation: 21
Excellent

Posted 01 May 2014 - 05:47 AM

will anybody tell me the way to select few items to perform update action by sending them to server?

 

I have a list view with list of object items, i want to select few of them to send it to the server. Can anyone help me for the same?

 

thanks,

bala



#3 Everett

Everett

    Ev

  • STV 5.0 Pro
  • PipPipPipPipPip
  • 191 posts
  • LocationMichigan
Reputation: 60
Outstanding

Posted 01 May 2014 - 06:33 PM

Hey Bala,

you can do that a few different ways and at different levels of the tableview hierarchy including section and cell.

 

If you add that capability at the cell level, you would be adding a SCPropertyDefinition to your class definition (or entity definition if your using core data) and then setting its attributes to be a selection cell.

 

Kind of like this:

 

SCPropertyDefinition *pd = [SCPropertyDefinition definitionWithName:name title:title type:SCPropertyTypeSelection];

 

pd.attributes = [SCSelectionAttributes attributesWithItems:choices allowMultipleSelection:allowMultiple allowNoSelection:allowMultiple autoDismissDetailView:calculatedAutoDismiss hideDetailViewNavigationBar:NO];

 

 

Or you could swap out your existing section (probably a SCArrayOfObjectsSection) with an SCObjectSelectionSection.  Just initialize it and add it to the tableview model like any other section.  It will allow you to select one or more object and store those objects in a NSSet you can access as: [section].selectedItemsIndexes.  

 

Initialize:

SCObjectSelectionSection *section = [SCObjectSelectionSection sectionWithHeaderTitle:@"Select Items" items:self.items itemsDefinition:serviceBoardDef];

 

Add to Tableview:

[self.tableViewModel addSection:section];

 

Process inside of done button method or inside of one of the cell actions like didSelect:

SCObjectSelectionSection *section = (id)[self.tableViewModel sectionAtIndex:0];

if (section.selectedItemsIndexes.count > 0) {  //do something  }

 

It's pretty straight forward once you get the hang of it.  It's also covered in the STV ebook.

best of luck,

Everett







Also tagged with one or more of these keywords: sections, cells

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users