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

Reload particular Cell's View #9

Closed
Rashesh-Bosamiya opened this issue Apr 18, 2017 · 8 comments
Closed

Reload particular Cell's View #9

Rashesh-Bosamiya opened this issue Apr 18, 2017 · 8 comments
Assignees

Comments

@Rashesh-Bosamiya
Copy link

I want to reload particular cell & even its attached expandable view.

How can I do this?

@younatics
Copy link
Owner

Hello @Rashesh-Bosamiya,
Is there any problem when you use reloadData function?

@Rashesh-Bosamiya
Copy link
Author

Actually I am using this library for showing filter options.

I have 7 different filters in each cell. Each filter has option to choose, when user choose any option from any cell's attached view, I have to reload whole tableView to highlight selected option.

Here is the problem, where I reload the whole tableView. It causes too much of dwindled performance.

So it's better to reload particular cell which needs refresh.

@younatics
Copy link
Owner

Hello @Rashesh-Bosamiya,
Maybe you can beginUpdate and reloadRowsAtIndexPaths and endUpdate
Is it helpful for you?

@Rashesh-Bosamiya
Copy link
Author

Rashesh-Bosamiya commented Apr 18, 2017

I have tried reloadRowsAtIndexPaths, but this reload only cell(s) not attached UIView's.

But not with beginUpdate & endUpdate.

I'll try with beginUpdate & endUpdate & inform you.

But you got my problem right?

@younatics
Copy link
Owner

Sure. I fully understand what you mean. If you can't do this, I will try in this weekend.
Cheers!

@younatics younatics self-assigned this Apr 19, 2017
@Rashesh-Bosamiya
Copy link
Author

Rashesh-Bosamiya commented Apr 20, 2017

My suggestion.

Can we have a method like tableView.expandCell(at indexPath:IndexPath)? or tableView.refreshCell(at indexPath:IndexPath)

That expand or refresh particular cell programmatically. informally we can achieve our goal to reload particular cell and its attached expandable view as well.

self.tableView.expandAll() kind of similar to this function.

@Rashesh-Bosamiya
Copy link
Author

Finally, I found out!

I just need to call reloadRowsAtIndexPaths.

The problem was:

I was passing incorrect indexPath in reloadRowsAtIndexPaths function.

I have return 6 in numberOfRowsInSection method.

Now, this library internally makes double numberOfRowsInSection as addition to expandable element.

Now if I want to reload 6th row, I just need to call tableView.reloadRows(at: [IndexPath(row: 6, section: 0)], with: .automatic)

By the way Thanks for you efforts and Interest.

@younatics
Copy link
Owner

Great! Thank you for contributing this library :)

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

No branches or pull requests

2 participants