Skip to main content

Docking rows

Comments

2 comments

  • Dapfor Team

    Hi Cory,

    Currently in the grid there is no API allows you to dock rows as first lines but you can use the following code to do it. Usually there is a small amount of docked rows in the grid, so this code does not degrade application performance.

    private void DockToTop(Row row)
    {
        List<Row> dockedRows = new List<Row>();
        foreach (Row item in grid1.Rows)
        {
            if(!Equals(item.Dock, RowDockStyle.Top))
            {
                break;
            }
            dockedRows.Add(item);
        }
        //Undock rows
        foreach (Row item in dockedRows)
        {
            item.Dock = RowDockStyle.None;
        }
        row.Dock = RowDockStyle.Top;
        //Redock rows
        foreach (Row item in dockedRows)
        {
            item.Dock = RowDockStyle.Top;
        }
    }

     But you're right, our developers will add the appropriate API.

    Best regards,

    The Dapfor Team

    0
  • Dapfor Team

    Hi,

    Other solution:

    The grid already contains an appropriate API. If you want to move the row, you only need to change a child index of this row. This works for docked and non-docked rows. Internally .Net Grid verifies indexes and prevents from moving non-docked rows to docked ones and vice-versa.
    More information about row indexes:

    http://www.dapfor.com/Help/NetGrid/html/06ac87ec-0a13-4504-ac2a-3a5...

    What is about your example:

    Row row = …
    row.Dock = RowDockStyle.Top;
    row.ChildIndex = 0;

    Best regards,

    The Dapfor Team

    0

Please sign in to leave a comment.

Powered by Zendesk