AccordionTableViewController icon indicating copy to clipboard operation
AccordionTableViewController copied to clipboard

Refresh all section data

Open renzrz opened this issue 7 years ago • 2 comments

Hello there,

I want to reload all section data because everytime i expand the section, it'll call network and put the response from network into button title.

In my viewdidload, i call a func called reloadAllData() and in my func reloadAllData() there's some code like this

func reloadAllData() {

     if dataProducts.isEmpty == true {
        
        self.requestSpinnerData()
        
    } else {
   
        oneSectionAlwaysOpen = false
        sections = allSetions()
        delegate = self
        openAnimation = .fade
        closeAnimation = .fade
    
    }
 }

When i segue into this view, it'll go to self.requestSpinnerData() because i'll use the data that i get from requestSpinnerData() for the section.title. and then it'll call reloadAllData() again for executing code inside else

And what i get is empty (there's no section inside my viewcontroller" How i can reload all section after i call another function?

Thankyou

renzrz avatar Jan 22 '19 10:01 renzrz

After you have all data, try:

sections = allSetions()
self.tableView.reloadData()

klevison avatar Jan 23 '19 02:01 klevison

After you have all data, try:

sections = allSetions()
self.tableView.reloadData()

Thank you so much sir.

Anyway, can i make the section as dynamic?

renzrz avatar Jan 23 '19 02:01 renzrz