********************************
*
* 目的:和windows explorer一样,点击数据窗口的标题 header ,对数据窗口进行排序
*
* 要求: 列的header 必须伪列名加 '_t'
*
* 如:
* Column Name : 'emp_id'
* Column Header : 'emp_id_t'
*
* 每次只能对一个列排序:
*
*************************************/
//数据窗口的clicked 时间:
String ls_old_sort, ls_column
Char lc_sort
/* Check whether the user clicks on the column header */
IF Right(dwo.Name,2) = '_t' THEN
ls_column = LEFT(dwo.Name, LEN(String(dwo.Name)) - 2)
/* Get old sort, if any. */
ls_old_sort = dw_1.Describe("Datawindow.Table.sort")
/* Check whether previously sorted column and currently clicked
column are same or not. If both are same then check for the sort
order of previously sorted column (A - Asc, D - Des) and change it.
If both are not same then simply sort it by 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
点击标题条对数据窗口排序
最新推荐文章于 2023-07-10 07:15:00 发布