oSourceObj = aSourceObj[1]
cRowName=osourceobjCAPTION
cgrid='thisformgrid1' &&&&表格的名字ogrid=&cgrid
cfilename=ogridRECORDSOURCEIF EMPTY(cfilename) OR SELECT(cfilename)=0
RETURN
ENDIFogridRECORDSOURCE=''
SELECT FROM (cfilename) INTO CURSOR (cfilename+'_tmp')
USE IN (cfilename)SELECT FROM (cfilename+'_tmp') ORDER BY &crowname INTO DBF (cfilename)
USE IN (cfilename+'_tmp')ogridRECORDSOURCE=cfilename
SELECT(cfilename)
GOTO TOP
ogridSETFOCUS
然后在表格的refresh(刷新方法)里写入如下代码:cgrid='thisform'+ALLTRIM(thisname)
ogrid=&cgridFOR gnCount = 1 TO thiscolumncount && header代理
cheader='thiscolumn'+alltrim(str(gncount))+'header1'
oheader=&cheader
oheadertooltiptext='单击按本列值重新排序表格数据'
BINDEVENT(oheader,"Click",thisform,"headerclick")
NEXT
当表格装载数据后,刷新表格(运行方法thisformgrid1refresh),即可将表格中header的click事件设置为自定义方法的代理。当单击表格header时,即运行headerclick自定义方法,将表格数据源表重新排格
1、点击表格--右键--编辑
2、双击表头。如图的,“单位名”打开表头“Header1”编辑框
3、在“Click”中输入代码
SET ORDE TO 单位名
4、退出--保存
注:相应字段在表中要有索引
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)