UltraGrid Win Hide all rows if no filter

I'm using UltraWin Grid 12 (Infragistics) for Win Forms (vb.net 2010 Framework 3.5) .

Is there a way to hide all rows and only show the filtered In rows?. I need to show nothing unless a filter is selected, and when all filters are unselected, hide all rows again.

I tried a For Each ... row.hidden = true, but no luck.

Answers


You can use a draw filter to hide all of the rows when there aren't any that are filtered out:

public class HideRowsDrawFilter:IUIElementDrawFilter
{
    private UltraGrid grid;
    public HideRowsDrawFilter(UltraGrid grid)
    {
        this.grid = grid;
    }

    public bool DrawElement(DrawPhase drawPhase, ref UIElementDrawParams drawParams)
    {
        if (this.grid.DisplayLayout.Rows.GetFilteredOutNonGroupByRows().Length == 0)
            return true;
        return false;
    }

    public DrawPhase GetPhasesToFilter(ref UIElementDrawParams drawParams)
    {
        if (drawParams.Element is RowUIElement)
            return DrawPhase.BeforeDrawElement;
        return DrawPhase.None;
    }
}

To set the draw filter of the grid, use the following:

this.ultraGrid1.DrawFilter = new HideRowsDrawFilter(this.ultraGrid1);

Note that this only prevents drawing of the rows and they are still there so unless you disable them in another way, selection, editing, and activation will still happen.


Cant u just set the default size to 0 ?

    myGrid.Rows.DefaultSize = 0
    myGrid.Refresh()

And when ever you are done getting the filters you need, just add the rows later. And when unselected just put your defaultsize again.


Need Your Help

Notice: Undefined index: PHP

php html css

I am having a little bit of issues with some Undefined index. I realize this could be solved by changing it the error reporting using error_reporting(E_ALL);, or ini_set('display_errors', '1');, but

bash - excluding directory in “for file in $(find …)”

linux bash for-loop find backup

I have to do a script, which copy all the *.txt files from home directory to the newly created directory specified in the first argument of this script (${1}).