请问大家,如何实现点击datawindows中的抬头实现datawindows中数据的排序功能?急!在线!马上给分!
请问大家,如何实现点击datawindows中的抬头实现datawindows中数据的排序功能?急!在线!马上给分! 问题点数:100、回复次数:13Top
1 楼lbx1979(Love Arsenal)回复于 2002-09-06 09:46:15 得分 30
在datawindow的click事件里
string ls_sortstr,dwoname,ls_text
dwoname = dwo.name
if right(dwoname,2)<>"_t" then return
this.setredraw(false)
//设置排序
if is_oldsortstr="" then
ls_sortstr = left(dwoname,len(dwoname) - 2) +" A "
elseif left(is_oldsortstr,len(is_oldsortstr) - 3 ) = left(dwoname,len(dwoname) - 2) then
if right(is_oldsortstr,3) = " A " then
ls_sortstr = left(dwoname,len(dwoname) - 2) + " D "
else
ls_sortstr = left(dwoname,len(dwoname) - 2) + " A "
end if
else
ls_sortstr = left(dwoname,len(dwoname) - 2) +" A "
end if
//设置标题
if len(is_oldsortstr)>0 then
this.modify(left(is_oldsortstr,len(is_oldsortstr) - 3)+"_t.font.Weight=400")
ls_text = this.Describe(left(is_oldsortstr,len(is_oldsortstr) - 3)+"_t.text")
if right(ls_text,2)="↑" or right(ls_text,2)="↓" then
this.modify(left(is_oldsortstr,len(is_oldsortstr) - 3)+"_t.text='"+left(ls_text,len(ls_text) - 2 )+"'")
end if
end if
this.modify(left(ls_sortstr,len(ls_sortstr) - 3)+"_t.font.weight=700")
is_oldsortstr = ls_sortstr
ls_text = this.Describe(dwoname + ".text")
if right(ls_sortstr,3) = " A " then
ls_text = dwoname + ".text='"+ls_text+"↑'"
else
ls_text = dwoname + ".text='"+ls_text+"↓'"
end if
this.modify(ls_text)
this.setsort(ls_sortstr); this.sort()
this.setredraw(true)Top
2 楼aqua_w(十月)回复于 2002-09-06 09:48:21 得分 10
if dwo.type = "text" then
li_x = integer(dwo.x)
li_columns = integer(this.object.datawindow.column.count)
for li_count = 1 to li_columns
is_name = this.describe("#" + string(li_count) + ".Name")
if li_x = integer(this.describe(is_name + ".x")) then
is_headername=dwo.name
ib_header=true
ii_LinePos = li_x + (Integer(This.Describe(is_name+".Width")) - 20)
this.modify(is_headername+".Border='5'")
exit
end if
next
if ib_header = true then
if is_order = "D" then
is_order = "A"
else
is_order = "D"
end if
end if
end if
Top
3 楼macro_fu()回复于 2002-09-06 09:54:10 得分 20
string ls_sort_column
If row > 0 Then
return
Else
IF dwo.Type = "text" THEN
//取列名
ls_sort_column = Left( dwo.name , Len( string ( dwo.name ) ) - 2 )
if is_sort = "A" then
is_sort = "D"
else
is_sort = "A"
end if
adw_request.SetSort( ls_sort_column + " " + is_sort )
adw_request.Sort ()
End If
End If
Top
4 楼ice2water(冰冻三尺)回复于 2002-09-06 10:01:43 得分 5
楼上说得对,注意检查在dw中标题名称的后两位一定是"_t",我认为应加一个变量保存上一次所点击的列名称,如果是同一列,选择A或D,如果是新的一列,就选择A,我认为这样比较符合习惯。Top
5 楼chen_yj(今天)回复于 2002-09-06 10:33:49 得分 0
谢谢大家!等我实现后给分!再一次谢谢!Top
6 楼fenglaotou(星期天)回复于 2002-09-06 10:39:44 得分 0
gzTop
7 楼warchild(大成若缺)回复于 2002-09-06 11:01:27 得分 10
if dwo.type = 'text' then
string colname
colname = left(string(dwo.name),len(string(dwo.name)) -2 )
setsort(""+colname+" A")
sort()
end ifTop
8 楼lesni(乐S你)回复于 2002-09-06 11:06:06 得分 5
网上有现成的u_dw,你继承使用即可。Top
9 楼joss(季节...夏至)回复于 2002-09-06 11:16:14 得分 10
楼上写得都对,不过我想我的还比较简单一点!!!
DW 的click事件中写
string ls_column,ls_dwo,ls_sort
ls_column = string(dwo.name)
if right(ls_column,2) <> "_t" then return 0
ls_dwo = mid(ls_column,1,len(ls_column) - 2)
ls_sort = ls_dwo + " A"
this.setsort(ls_sort)
this.sort()
前提:
1、数据窗口中的标题文本文件用"_t"结束
2、数据窗口中的标题文本文件名与下方的内容名应该对应!
如"name_t"与name对应
试试
我都有用过的!!
Top
10 楼suziniren(泥人)回复于 2002-09-06 11:38:30 得分 5
不要用题头了,将它们改成按钮,
然后在
DW_OBJECT.BUTTONCLICKED 事件中
根据当前点击的按击进行排序设置
Top
11 楼sandorn(行云流水)回复于 2002-09-06 12:39:27 得分 0
studyTop
12 楼sandorn(行云流水)回复于 2002-09-06 12:41:05 得分 0
该结贴了吧??!Top
13 楼spoondrift1()回复于 2002-09-06 13:22:21 得分 5
用pfc的数据排序功能u_dwTop




