When I deselected any item of level 2 (21,22 or 23) I would like the other item at the same level auto collapse too.
I have tried with this function:
- (void)collapseSameLevelItem:(Object*)item {
if (item.level > 1) {
Object* parentItem = [self.treeView parentForItem:item];
for (Object* category in parentItem.children) {
if ([self.treeView isCellForItemExpanded:category]) {
[self.treeView collapseRowForItem:category];
RATableViewCell* sameLevelCell = (RATableViewCell*)[self.treeView cellForItem:item];
[sameLevelCell setIsExpanded:NO];
}
}
}
}
But I realize that isCellForItemExpanded and collapseRowForItem function did not work as I experted.
The indexPath that I got at - (void)collapseRowForItem:(id)item collapseChildren:(BOOL)collapseChildren withRowAnimation:(RATreeViewRowAnimation)animation:
I have a tree as bellow:
When I deselected any item of level 2 (21,22 or 23) I would like the other item at the same level auto collapse too. I have tried with this function:
But I realize that
isCellForItemExpanded
andcollapseRowForItem
function did not work as I experted.The
indexPath
that I got at- (void)collapseRowForItem:(id)item collapseChildren:(BOOL)collapseChildren withRowAnimation:(RATreeViewRowAnimation)animation
:Do you guys have any suggestion for me in this case? Thanks!