This sample is for sorting the rows in a grid datawindow ascending or descending based on the user clicking the column header. It only allows for a single column sort at a time. //Clicked event of datawindow // You need an instance variable (string is_sort_column) // This script first checks to see if we've clicked…