Home - Forums-.NET - FlyGrid.Net (Windows Forms) - GetSelection() during ColumnSortOrderChanging()

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

GetSelection() during ColumnSortOrderChanging()
Link Posted: 29-Apr-2007 23:49
Hi

When I use method fg.GetSelection() during ColumnSortOrderChanging() event, my application hang ~13 seconds !!!

Thes same behaviour I have when I set fg.Selected = node during ColumnSortOrderChanged() event ( ~20 seconds ). My table have ~46.000 rows.

Maybe there is another way to restore row selections after column sort order hanged?

FG 1.5.0.2

Robert
Link Posted: 07-May-2007 23:38
Do you want any additional information
Link Posted: 08-May-2007 06:07
Yes, please, provide us with a sample.
We've tried to reproduce this situation, but GetSelection method works fast.
Link Posted: 14-May-2007 02:16
It is my code:


          this.fgTabela.ColumnSortOrderChanging += new NineRays.Windows.Forms.ColumnSortOrderChangingHandler(ColumnSortOrderChanging);
          this.fgTabela.ColumnSortOrderChanged += new NineRays.Windows.Forms.ColumnSortOrderChangedHandler(ColumnSortOrderChanged);


    private object[] sortOrderSelection = null;
    private object focusedValue = null;
    private Column sortColumn = null;
    public void ColumnSortOrderChanging(object sender, Column column, SortOrder value, ref bool sorted)
    {
      sortColumn = column;
      if ( fgTabela.Selected != null )
      {
        focusedValue = fgTabela.Selected.Value;
      }
      else
      {
        focusedValue = null;
      }

      // very slow code -- begin
      NodeBase[] selection = fgTabela.Rows.GetSelection();
      // very slow code -- end

      if (selection != null && selection.Length > 0)
      {
        sortOrderSelection = new object[selection.Length];
        for(int i=0; i< selection.Length; i++)
          sortOrderSelection[i] = selection[i].Value;
      }
      else
      {
        sortOrderSelection = null;
      }
    }

    public void ColumnSortOrderChanged(object sender, Column column)
    {
      if ( sortColumn == column )
      {
        if ( focusedValue != null )
        {
          NodeBase node = null;
          for ( int i = 0;  i < fgTabela.Rows.Items.Count; i++ )
          {
            node = fgTabela.Rows.Items[i];
            if ( focusedValue.Equals(node.Value) )
            {
              // very slow code -- begin
              fgTabela.Selected = node;
              // very slow code -- end
              break;
            }
          }
        }

        if ( sortOrderSelection != null )
        {
          NodeBase node = null;
          for ( int i = 0;  i < fgTabela.Rows.Items.Count; i++ )
          {
            node = fgTabela.Rows.Items[i];
            if (Array.IndexOf(sortOrderSelection, node.Value) != -1)
            {
              // very slow code -- begin
              node.Selected = true;
              // very slow code -- end
              break;
            }
          }
        }
      }
    }
Link Posted: 24-May-2007 19:26
Any solution ??
Link Posted: 19-Jun-2007 07:41
Helo, helo
[email protected]#[email protected]#[email protected]#$!%#%@#%@$%@#%
Can anybody help me?