Ejemplo n.º 1
0
        private void PurgeVirtualDeletedRows(GridPanel panel)
        {
            int count = 0;
            int topIndex = 0;
            int offset = 0;

            int activeIndex =
                (panel.ActiveRow != null) ? panel.ActiveRow.RowIndex : -1;

            try
            {
                SelectedElementCollection sec = panel.GetDeletedRows();

                for (int i = sec.Count - 1; i >= 0; i--)
                {
                    GridRow row = sec[i] as GridRow;

                    if (row != null)
                    {
                        count++;
                        topIndex = row.RowIndex - 1;

                        if (row.RowIndex < activeIndex)
                            offset++;

                        panel.SetDeleted(row, false);
                        panel.DataBinder.RemoveRow(row);
                    }
                }
            }
            finally
            {
                panel.VirtualRowCount -= count;
                panel.VirtualRows.MaxRowIndex = topIndex;
            }

            if (offset > 0)
                panel.LatentActiveRowIndex = activeIndex - offset;
        }