标题:Grid表格如何只显示部分记录?
只看楼主
mywisdom88
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:190
帖 子:3125
专家分:8340
注 册:2015-3-25
结帖率:98.96%
已结贴  问题点数:20 回复次数:4 
Grid表格如何只显示部分记录?
我表单上用页框分开2页
在第2页上用了个GRID表格,数据源和第1页相同
如:
create cursor tmp1(xm c(20),zw c(20))
insert into tmp1(xm,zw) values("张三1","老师")
insert into tmp1(xm,zw) values("张三2","老板")
insert into tmp1(xm,zw) values("张三3","经理")
insert into tmp1(xm,zw) values("张三4","老总")
insert into tmp1(xm,zw) values("张三5","员工")
insert into tmp1(xm,zw) values("张三6","主管")
在页框第1页,能显示和操作所有记录,即6个记录
但在页框2页,用GRID显示记录,能不能只显示某些记录,不如不显示 ZW="老板"的记录?
如果GRID的数据源和第1页不同,肯定是可以的;
我想来回在第1页与第2页之间操作数据,如果用2个数据源,就会出现数据不同步。。。


搜索更多相关主题的帖子: create cursor insert values 数据源 
2016-03-06 18:02
mywisdom88
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:190
帖 子:3125
专家分:8340
注 册:2015-3-25
得分:0 
在做1个权限表单,
我想把 MenuType="ROT","SOP","SOM"的数据不在GRID上显示,因为这些数据不需要修改。。
菜单1.rar (41.73 KB)
2016-03-06 18:11
hu9jj
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
来 自:红土地
等 级:贵宾
威 望:396
帖 子:11713
专家分:43267
注 册:2006-5-13
得分:5 
看看帮助文件中的有关select、locat等命令。

活到老,学到老! http://www. E-mail:hu-jj@
2016-03-06 19:09
吹水佬
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
等 级:版主
威 望:432
帖 子:10064
专家分:41463
注 册:2014-5-20
得分:15 
参考示例

程序代码:
** Test.prg
create cursor tmp1(xm c(20),zw c(20))
insert into tmp1(xm,zw) values("张三1","老师")
insert into tmp1(xm,zw) values("张三2","老板")
insert into tmp1(xm,zw) values("张三3","经理")
insert into tmp1(xm,zw) values("张三4","老总")
insert into tmp1(xm,zw) values("张三5","员工")
insert into tmp1(xm,zw) values("张三6","主管")
of = CREATEOBJECT("form1")
of.show(1)
CLEAR ALL 

DEFINE CLASS form1 as Form
    ADD OBJECT pf1 as Pageframe1 WITH width=this.width,height=this.Height
ENDDEFINE

DEFINE CLASS Pageframe1 as Pageframe
    ADD OBJECT P1 as Page1
    ADD OBJECT P2 as Page1
ENDDEFINE

DEFINE CLASS Page1 as Page
    ADD OBJECT grid1 as grid
    
    PROCEDURE Init
        this.grid1.width  = this.Parent.width
        this.grid1.height = this.Parent.Height
    ENDPROC
    
    PROCEDURE Activate
        IF this.Parent.ActivePage == 2
            SET FILTER TO !(ALLTRIM(zw) == "老板")
        ELSE
            SET FILTER TO
        ENDIF
        GO TOP 
        this.grid1.SetFocus
    ENDPROC
ENDDEFINE


[此贴子已经被作者于2016-3-6 20:03编辑过]

2016-03-06 19:58
mywisdom88
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:190
帖 子:3125
专家分:8340
注 册:2015-3-25
得分:0 
以下是引用吹水佬在2016-3-6 19:58:20的发言:

参考示例
 
** Test.prg
create cursor tmp1(xm c(20),zw c(20))
insert into tmp1(xm,zw) values("张三1","老师")
insert into tmp1(xm,zw) values("张三2","老板")
insert into tmp1(xm,zw) values("张三3","经理")
insert into tmp1(xm,zw) values("张三4","老总")
insert into tmp1(xm,zw) values("张三5","员工")
insert into tmp1(xm,zw) values("张三6","主管")
of = CREATEOBJECT("form1")
of.show(1)
CLEAR ALL  
 
DEFINE CLASS form1 as Form
    ADD OBJECT pf1 as Pageframe1 WITH width=this.width,height=this.Height
ENDDEFINE
 
DEFINE CLASS Pageframe1 as Pageframe
    ADD OBJECT P1 as Page1
    ADD OBJECT P2 as Page1
ENDDEFINE
 
DEFINE CLASS Page1 as Page
    ADD OBJECT grid1 as grid
     
    PROCEDURE Init
        this.grid1.width  = this.Parent.width
        this.grid1.height = this.Parent.Height
    ENDPROC
     
    PROCEDURE Activate
        IF this.Parent.ActivePage == 2
            SET FILTER TO !(ALLTRIM(zw) == "老板")
        ELSE
            SET FILTER TO
        ENDIF
        GO TOP  
        this.grid1.SetFocus
    ENDPROC
ENDDEFINE
SET FILTER TO !INLIST(ALLTRIM(MenuType),"SOP","SOM","ROT")
2016-03-06 21:36



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-462199-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.157286 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved