Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

expandDefaultRowForItem #259

Open
Gusont opened this issue Oct 29, 2018 · 0 comments
Open

expandDefaultRowForItem #259

Gusont opened this issue Oct 29, 2018 · 0 comments

Comments

@Gusont
Copy link

Gusont commented Oct 29, 2018

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];
    }
    }];

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant