Home - Forums-.NET - FlyGrid.Net (Windows Forms) - ROW BackColor....is this possible?

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

ROW BackColor....is this possible?
Link Posted: 18-Apr-2006 05:34
You can use some of the follwing methods to repaint node:
1. FlyGrid.InvalidateRow
2. FlyGrid.InvalidateNode
3. If you need to invalidate certain cell of the node use FlyGrid.InvalidateCell method.
Link Posted: 18-Apr-2006 06:55
If I want to refresh the entire grid (after sorting nodes), I need to iterate through the nodes:


            Dim iRow As Integer
            For iRow = 0 To selfRelatedGrid.Rows.Items.Count - 1
                Dim node As NineRays.Windows.Forms.Data.Node
                node = selfRelatedGrid.Rows.Items(iRow)
                selfRelatedGrid.InvalidateNode(port,node)
            Next


How do I access the \"port\" in VirtualMode?

Thanks!
Eric
Link Posted: 20-Apr-2006 06:34
Bump...
Link Posted: 20-Apr-2006 09:00
Sorry, for delays
It depends on context.
If you need to invalidate nested grid that nested under INestedGridNode instance, use following code:
[c#]
private void InvalidatePortOfNode(NodeBase node)
{
  INestedGridNode nestedHolder = node as INestedGridNode;
  if (nestedHolder != null)
  {
    FlyGridViewPort nested = nestedHolder.NestedInternal;
    if (nested != null)
    {
      //invalidate all cells.
      nested.InvalidateRows(0, nested.RowCount, 0, nested.ColumnCount);
    }
  }
}
Link Posted: 21-Apr-2006 08:07
There is no nesting in my app - simply trying to invalidate all of the nodes in the tree (using selfRelated example in VirtualMode) so that the Styled Nodes backcolor get refreshed after each re-sorting of the grid.

This code is at the end of the PrepareGrid(ByVal grid As FlyGrid) method in the selfRelatedGrid example:


            Dim iRow As Integer
            For iRow = 0 To selfRelatedGrid.Rows.Items.Count - 1
                Dim node As NineRays.Windows.Forms.Data.Node
                node = selfRelatedGrid.Rows.Items(iRow)
                'selfRelatedGrid.InvalidateNode(port,node)
            Next

            selfRelatedDt.DefaultView.Sort = \"Parent, IntOver\"
            AddHandler grid.VirtualMode_GetCount, AddressOf Me.grid_VirtualMode_GetCount
            AddHandler grid.VirtualMode_GetNodeCellValue, AddressOf Me.grid_VirtualMode_GetNodeCellValue
            AddHandler grid.VirtualMode_SetNodeCellValue, AddressOf Me.grid_VirtualMode_SetNodeCellValue
            AddHandler grid.VirtualMode_HasChildren, AddressOf Me.grid_VirtualMode_HasChildren
            AddHandler grid.VirtualMode_InitNewNode, AddressOf Me.grid_VirtualMode_InitNewNode
            grid.Rows.VirtualMode = True

        Catch ex As Exception
            ExceptionManager.Publish(ex.InnerException)
        End Try
    End Sub


I'm not sure how to access the \"port\" of the existing grid, and whether the invalidation code is correctly placed so that the nodes will be re-initialized as Styled Nodes with the correct backcolor.

Thanks in advance for your guidance!

Eric
Link Posted: 23-Apr-2006 09:33
If no nesting used you can use flyGrid.ActiveRootPort or flyGrid.ActivePort to invalidate nodes.
Link Posted: 14-Dec-2006 09:46
Thank you ferdbiffle and NineRays...this thread helped a lot.

Just one note, if you are using Nested Grids then your CoolNode has to inherit from VirtualNestedGridNode instead.