User Rating: 3 / 5

Star ActiveStar ActiveStar ActiveStar InactiveStar Inactive
 

This article describes how to click on the header of a datawindow, allows the datawindow to be ordered by that column. The name of the column header must have the same name as in the database and finish in _t

For example:

Column name: emp_id
Header name: emp_id_t

 

You can only sort by one column at a time.

 

String ls_old_sort, ls_column 

Char lc_sort 

/* Check when the user clicks on the header */ 

IF Right(dwo.Name,2) = "_t" THEN 

   ls_column = LEFT(dwo.Name, LEN(String(dwo.Name)) - 2) 

   /*Save the last sort, if there were any*/ 

   ls_old_sort = dw_1.Describe("Datawindow.Table.sort") 

   /* It checks when a column was previously ordered and the one that is clicked at the moment is the same or not. If it is the same, then the order of ordering of the previous order (A - Ascending, D - Descending) is checked and changed. If the columns are not the same, order them in ascending order. */ 

 

   IF ls_column = LEFT(ls_old_sort, LEN(ls_old_sort) - 2) THEN 

      lc_sort = RIGHT(ls_old_sort, 1) 

      IF lc_sort = 'A' THEN 

         lc_sort = 'D' 

      ELSE 

         lc_sort = 'A' 

      END IF 

      dw_1.SetSort(ls_column+" "+lc_sort) 

   ELSE 

      dw_1.SetSort(ls_column+" A") 

   END IF 

   dw_1.Sort() 

END IF 


Autor : E.Bala muthaiya - This email address is being protected from spambots. You need JavaScript enabled to view it. 

Pin It