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

Does not refresh with Filter applied and DataTable changes. #85

Closed
JackSadowski opened this issue Apr 30, 2022 · 3 comments
Closed

Does not refresh with Filter applied and DataTable changes. #85

JackSadowski opened this issue Apr 30, 2022 · 3 comments

Comments

@JackSadowski
Copy link

My problem is that the Grid does no update properly when and Filter is active and underlying data changes via DataTable.
I bind DataTable using BindingSource like this:

bindingSource = new BindingSource();
grid.DataSource = bindingSource;
bindingSource.DataSource = dataTable;

I apply a filter on one of the columns (using the built-in menu). Then I delete a row in the dataTable:

dataTable.Rows.RemoveAt(index);

The removed row is not reflected in the Grid. Ie. the grid still shows that row.
Actually, occasionally it does work properly. When it does it's always on the first operation, then it always stops working for subsequent delete operations. Ie: I still see the row in the Grid, even though it has been deleted from the table...
Can you help?

@davidegironi
Copy link
Owner

Hello, I close this as an Issue cause it's not related to the component, it's something related to you BindingSource. I suggest you to build a simple project and work on that.
Take a look at the FAQ, specificaly this here: #16

@JackSadowski
Copy link
Author

You are correct and I found the problem on my end. Solution may be useful to others if they run into this:
I was looking for the row to delete in the grid.Rows and taking the index of row to delete. Now, when the rows are filtered, the grid row number does NOT correspond to DataTable row number. I had to look for node to delete in the DataTable and delete it there.

@davidegironi
Copy link
Owner

Thank you for sharing! Please add a link you your solution to issue #16 that is related to this. Thanks!

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