点击标题条对数据窗口排序

********************************
*
* 目的:和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

 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值