trigger ColumnHeader_LClicked

Interactive trigger that handles processing when the user clicks a column header of the Grid widget. Typically, this is used to sort occurrences by the associated field's value.

trigger ColumnHeader_LClicked
  params
    string fieldName : in
    numeric shiftKey : in
  endparams

    ; <Your code here>
   
end ; trigger ColumnHeader_LClicked
Applies to: Form widgets: egrid (Grid)
Activation: Activated when the user clicks a column header of the Grid widget, with or without any combination of the Shift, Alt, and Control keys.
Default behavior: None
Behavior upon completion: None

Parameters

  • fieldName—field name of which the column header is clicked
  • shiftKey—integer that indicates whether the Shift, Alt, Control, or a combination of these keys, is pressed when the column header is clicked.
Values returned in shiftKey
shiftKey Shift Control Alt
0 Not pressed Not pressed Not pressed
1 Pressed Not pressed Not pressed
2 Not pressed Pressed Not pressed
3 Pressed Pressed Not pressed
4 Not pressed Not pressed Pressed
5 Pressed Not pressed Pressed
6 Not pressed Pressed Pressed
7 Pressed Pressed Pressed

The following ProcScript orders the occurrences in the hit list based on the clicked column header:

trigger ColumnHeader_LClicked
params
   string fieldName: in
   numeric shiftKey : in
endparams
; sort occurrences based on the clicked column
if ($sortOrder$ = "%%fieldName%%%:a")
   $sortOrder$ = "%%fieldName%%%:d"
else
   $sortOrder$ = "%%fieldName%%%:a"
endif

sort/e "<$entname>", $sortOrder$
$prompt = fieldName

end ; trigger ColumnHeader_LClicked