Delete Grid Blank Rows Entered by Users When Saving

本文介绍了一段代码,用于解决用户在网格中输入数据时,因多次点击加号按钮导致出现额外空行的问题。通过遍历所有行并检查关键字段是否为空,该代码能够有效地删除这些多余的空行。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Sometimes users click the "+" on the grid to enter data but end up
clicking it more than once and getting some extra empty rows in the
gird. The peopleCode to get rid of any extra empty grid rows when the
user saves is as follows:


Local Rowset &pnlbuf;
Local Rowset &data;
Local number &Rows;
Local string &Ethnic, &Descr, &Primary;
/*If there is a blank row entered, delete the row*/
&pnlbuf = GetLevel0();
&data = &pnlbuf(1).GetRowset(Scroll.DIVERS_ETHNIC);
&Rows = &data.ActiveRowCount;
For &i = &Rows To 1 Step - 1
&Ethnic = &data.GetRow(&i).GetRecord(Record.DIVERS_ETHNIC).GetField(Field.ETHNIC_GRP_CD).Value;
&Descr = &data.GetRow(&i).GetRecord(Record.ETHNIC_GRP_TBL).GetField(Field.DESCR50).Value;
&Primary = &data.GetRow(&i).GetRecord(Record.DIVERS_ETHNIC).GetField(Field.PRIMARY_INDICATOR).Value;
If None(&Ethnic) And
None(&Descr) And
None(&Primary) Then
&data.DeleteRow(&i);
End-If;
End-For;

转载于:https://www.cnblogs.com/GoDevil/archive/2008/08/18/1270389.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值