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

Reloading data doesn't behave correctly #9

Open
bouchtaoui-dev opened this issue May 13, 2015 · 2 comments
Open

Reloading data doesn't behave correctly #9

bouchtaoui-dev opened this issue May 13, 2015 · 2 comments

Comments

@bouchtaoui-dev
Copy link

Hello my friend,

You nice expandable tableview works well for static data array. However, when my array changes (mutable), I trigger [tableview reloadData]; which doesn't call numberOfParentCells and so it has the outdated number of rows, which results in crashes because of outbound exception. I don't have much time, so could you fix that, as you're familiar with the code.

Thank you.

@emersoncpp
Copy link

Hello,

    I fix this issue doing this modification in JKExpandTableView.m:
  • (NSUInteger) parentIndexForRow:(NSUInteger) row {
    NSUInteger parentIndex = -1;

    NSUInteger i = 0;

    while (i <= row) {
    parentIndex ++;
    i++;
    if ([self.expansionStates count]) // Add this line
    if ([[self.expansionStates objectAtIndex:parentIndex] boolValue]) {
    i++;
    }
    }
    NSLog(@"parentIndexForRow row: %ld parentIndex: %ld", (long)row, (long)parentIndex);
    return parentIndex;
    }

@bouchtaoui-dev
Copy link
Author

Hello,
Sorry, I was on holiday.
Thanks for the fix, I'll try it out soon.
I hope this fix can be added to the project.

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

2 participants