Home - Forums-.NET - FlyGrid.Net (Windows Forms) - Filtered Row Count

FlyGrid.Net (Windows Forms)

.NET Datagrid - Fast, highly customizable, industry standards .NET data grid control for WinForms

This forum related to following products: FlyGrid.Net

Filtered Row Count
Link Posted: 14-Jul-2008 12:01
Hi,

Is there a way to get the number of rows that are in the grid after setting filters on the columns? Checking FlyGrid.Rows.Items.Count still returns the total number of nodes that've been added (which makes sense I guess). But I'd like to know how many nodes are available after being filtered.

Thanks in advance,

~Ian
Link Posted: 31-Jul-2008 08:55
No one? Seriously?
Link Posted: 02-Mar-2010 12:18
I couldn't find anything built in, so I used the following code and it works great. Had to manually check for visible and count, cause the filters obscure the value flyMachines.Rows.Items.Count variable.


private void flyMachines_NodeChange(object sender, NodeBase node)
{
    int rowCount = 0;
    try
    {
      foreach (NodeBase nb in flyMachines.Rows.Items)
      {
         if (nb.VisibleInView)
            rowCount++;
      }

      this.tsslRows.Text = _statusRows + rowCount.ToString();
    }
    catch { }
}


Hope this helps!

Hogan
Link Posted: 02-Mar-2010 15:08
If you want to know the visible rows/nodes count, there is a simplest way is to request the FlyGridViewPort.RowCount property:

[c#]
private int GetFilteredNodeCount(FlyGrid flyGrid, NodeBase node)
{
  return flyGrid.ActivePort.RowCount;//when you don't use nesting
  /*-------OR-------*/
  //we need to get the viewport associated with the node
  FlyGridViewPort port = flyGrid.GetPort(node);
  return (port != null) ? port.RowCount : 0;
}