Open adolfhoathyla opened 7 years ago
By expanding one cell at a time, are you referring to expanding the subcells one by one, instead of all the subcells at the same time?
I'm referring to mainCell. For example, expand one mainCell and when I click another different mainCell, the previous one is unexpand. I would like always only one mainCell is expanded. Are you understand?
I see. There is no such functionality at the moment, but it seems an interesting feature to add to future versions of the library. I will see what I can do in there. Pull requests are always welcome too!
I understand. So when you get any progress, could you let me know? Or some tips for do this. My e-mail address:
adolfo.athyla@gmail.com
Thanks!!
Sure! I will take a look as soon as I can, I'm sure I can do that by next month. If you wanna try by yourself in the meanwhile, you should take a look to the tableView( _, didSelectRowAt) function of the library:
override open func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let expandableIndexPath = expandableIndexPathForIndexPath(indexPath)
if cellsTypeArray.get(indexPath.row) == .mainCell{
let newIndexPath: IndexPath = IndexPath(row: indexPath.row + 1, section: indexPath.section)
if cellsTypeArray.get(newIndexPath.row) != .subCell{
expandCellAtIndexPath(indexPath, tableView: tableView)
}
else{
unexpandCellAtIndexPath(indexPath, tableView: tableView)
}
expandableTableView.expandableDelegate.expandableTableView(expandableTableView, didSelectRowAtExpandableIndexPath: expandableIndexPath)
}
else if cellsTypeArray.get(indexPath.row) == .subCell {
expandableTableView.expandableDelegate.expandableTableView(expandableTableView, didSelectSubRowAtExpandableIndexPath: expandableIndexPath)
}
}
The first idea that comes to mind is to collapse the cell you have currently open before expanding the new one. Keeping a track of the current expanded one could be a good idea, or collapsing all of them.
Nice! I arrived in a temporary solution. I'll try to improve. Waiting for your advance. Thanks @enricmacias !!!!
Hey there.
I would like to know an easy way to expand only one cell at a time. Is it possible?