DataGrid.OnBandBaseClick

Fore Syntax

Sub OnBandBaseClick(Sender: Object; Args: IDataGridBandEventArgs);

Begin

//set of operators;

End Sub OnBandBaseClick;

Parameters

Sender. The parameter that returns the component that generated the event.

Args. The parameter that determines event parameters.

Description

The OnBandBaseClick event occurs after clicking on the column or band header.

Comments

After clicking on the column header or band, the following occurs:

Fore Example

Executing the example requires a form and the DataGrid component with the DataGrid1 identifier on the form.

The handlers must be assigned for the following events:

Add a link to the MathFin system assembly.

Class DATAGRID_ONBANDBASECLICKForm: Form
    DataGrid1: DataGrid;
    Rows: IDataGridRows;
    Arr: Array Of String;

Sub DATAGRID_ONBANDBASECLICKFormOnShow(Sender: Object; Args: IEventArgs);
Var
    i: integer;
Begin
    //Set number of table rows and columns
    DataGrid1.AbsoluteRowCount := 5;
    DataGrid1.ColumnCount := 2;
    Arr := New String[DataGrid1.AbsoluteRowCount];
    //Fill table with data
    For i := 0 To DataGrid1.AbsoluteRowCount - 1 Do
        DataGrid1.CellValue(i, 0) := i + Math.Power(10, DataGrid1.AbsoluteRowCount - 1 - i);
        //Copy each row value
        Arr[i] := DataGrid1.CellValue(i, 0);
    End For;
        
End Sub DATAGRID_ONBANDBASECLICKFormOnShow;

Sub DataGrid1OnBandBaseClick(Sender: Object; Args: IDataGridBandEventArgs);
Var
    i: integer;
Begin
    //Copy value of each row of the first column
    For i := 0 To DataGrid1.AbsoluteRowCount - 1 Do
        Arr[i] := DataGrid1.CellValue(i, 0);
    End For;
End Sub DataGrid1OnBandBaseClick;

Sub DataGrid1OnSort(Sender: Object; Args: IDataGridColumnEventArgs);
Var
    i: integer;
Begin
    //Fill the second column with data of the first column before sorting
    For i := 0 To DataGrid1.AbsoluteRowCount - 1 Do
        DataGrid1.CellValue(i, 1) := Arr[i];
    End For;
End Sub DataGrid1OnSort;
End Class DATAGRID_ONBANDBASECLICKForm;

After executing the example, after clicking on the first column header the rows are sorted in ascending order of their values, and the first column values before sorting are written to the second column.

See also:

DataGrid