Code Monkey home page Code Monkey logo

Comments (7)

davidegironi avatar davidegironi commented on June 6, 2024

Hello, are you talking about this behaviour? #116

from advanceddatagridview.

will-scc avatar will-scc commented on June 6, 2024

Hello, are you talking about this behaviour? #116

Nope. I would expect setting the AdvancedDataGridView.FilterAndSortEnabled property to false to disable filtering and sorting for the whole data grid, but when changing the values of a filtered column when this is set to false will still cause the rows to be removed from the grid view.

from advanceddatagridview.

davidegironi avatar davidegironi commented on June 6, 2024

I still don't fully understaind. Can you share a sample project?

from advanceddatagridview.

will-scc avatar will-scc commented on June 6, 2024

I still don't fully understand. Can you share a sample project?

Have a look at this fork: https://github.com/will-scc/advanceddatagridview/tree/master

I've added lines 418 onwards to FormMain.cs to hopefully demo the issue I'm having. Let me know if that helps, or if I can provide any further detail.

First, set the filter on the boolean column to be either true or false:
image

Then, select a number of cells in the boolean column:
image

Then, right click -> Toggle Boolean:
image

Note that every time the cell value changes, the row is removed from the grid view (causing the CellEnter event to be triggered for the next cell). I would expect the rows to remain in view until AdvancedDataGridView.FilterAndSortEnabled is set back to true.

I hope that makes sense?

Also note, I had to update references to net40 to net48 to get it to build. If that causes you issues you should be able to change them back.

from advanceddatagridview.

davidegironi avatar davidegironi commented on June 6, 2024

I'm still not sure about the behaviour you are searching for.
Could it be SetFilterAndSortEnabled on the column instead, like below?

private void toggleBooleanToolStripMenuItem_Click(object sender, EventArgs e)
{
            //after this, i would not expect see any filtering behaviour happening (i.e. rows removed from view)
            //advancedDataGridView_main.FilterAndSortEnabled = false;
            advancedDataGridView_main.SetFilterAndSortEnabled(advancedDataGridView_main.Columns["boolean"], false);

            foreach (DataGridViewCell cell in advancedDataGridView_main.SelectedCells)
            {
                if (cell.ColumnIndex == 6)
                {
                    //Swap cell value for demo
                    cell.Value = !(bool)cell.Value;
                }
            }

            //once this is set, filtering can happen again and now rows should disappear from view
            //advancedDataGridView_main.FilterAndSortEnabled = false;
            advancedDataGridView_main.SetFilterAndSortEnabled(advancedDataGridView_main.Columns["boolean"], true);
}

from advanceddatagridview.

will-scc avatar will-scc commented on June 6, 2024

Setting AdvancedDataGridView.FilterAndSortEnabled = false does not disable filtering and sorting on the data grid view... I'm not sure how else to say that. 😅

I tried advancedDataGridView_main.SetFilterAndSortEnabled(advancedDataGridView_main.Columns["boolean"], false); but doing so changes the SelectedCells property to a random cell (it seems), so it kinda breaks everything else.

from advanceddatagridview.

davidegironi avatar davidegironi commented on June 6, 2024

The FilterAndSortEnabled field is supposed to work on component initialization, taking the AdvancedDataGridViewSample project as example, you can add this line at the end of the FormMain costructor
advancedDataGridView_main.FilterAndSortEnabled = false;

The SetFilterAndSortEnabled method works after the columns has been added too. Of course it change the underlying datasource Filter, so the selected cell changes, you have to record the selected cell, and set it back again.

from advanceddatagridview.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.