RATreeView icon indicating copy to clipboard operation
RATreeView copied to clipboard

expandDefaultRowForItem

Open Gusont opened this issue 7 years ago • 0 comments

I have a need.add a Default Row. This realization Code,

  • (void)searchModelWith:(NSArray<OrganizationModel *> *)models{ [models enumerateObjectsUsingBlock:^(OrganizationModel * _Nonnull model, NSUInteger idx, BOOL * _Nonnull stop) { if ([model.key isEqualToString:[GlobalCurrencyInfo SharedInstance].userInfoModel.departMentId]) { [self.treeViewexpandRowIndex addObject:@(idx)]; [self searchChildrenindex:models datas:self.organizationArr]; {///expandTreeView __block NSArray *marr = self.organizationArr; [[[self.treeViewexpandRowIndex reverseObjectEnumerator] allObjects] enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { OrganizationModel *item = marr[[obj integerValue]]; item.isOpen = YES; [self.treeView expandRowForItem:item]; [self.treeView reloadRowsForItems:@[item] withRowAnimation:RATreeViewRowAnimationNone]; marr = item.children; }]; model.isOpen = NO; [self treeView:self.treeView didSelectRowForItem:model]; } return; } if (model.children.count) { [self searchModelWith:model.children]; }

    }]; }

  • (void)searchChildrenindex:(NSArray *)childerns datas:(NSArray *)datas{

    [datas enumerateObjectsUsingBlock:^(OrganizationModel * _Nonnull model, NSUInteger idx, BOOL * _Nonnull stop) { if (model.children == childerns) { [self.treeViewexpandRowIndex addObject: @(idx)]; [self searchChildrenindex:datas datas:self.organizationArr]; } if (model.children.count) { [self searchChildrenindex:childerns datas:model.children]; } }];

}

Gusont avatar Oct 29 '18 07:10 Gusont