在客户端删除UltraWebGrid的所有行

本文提供了一种在客户端使用JavaScript实现UltraWebGrid组件中所有行批量删除的有效方法,并对比了官方文档中无效的示例。

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

有时需要在客户端上删除某个UltraWebGrid中所有的行,而如果按照帮助文件中例子的方法来操作的话,是无法删除行的。经询问NetAdvantage工程师,给出一个能用的例子。

//帮助中的例子,不可用
  1. function DeleteRow ( ) {
  2. // Row deletion needs to be allowed
  3. igtbl_getGridById ( "UltraWebGrid1" ). AllowDelete= 1;
  4. // Get the first row in the grid
  5. var row=igtbl_getRowById ( "UltraWebGrid1r_0" );
  6. // Delete the first row in the grid
  7. igtbl_deleteRow ( "UltraWebGrid1", "UltraWebGrid1r_0" );
  8. // Create a counter for the row id
  9. var cnt= 0;
  10. // Create a loop, if the row has a next sibling then we need to delete it
  11. while (row. NextSibling != null ) //在这步,row.NextSibling总是为Undefined类型。以致不能删除行
  12. {
  13. // Increment the counter for the next rowID
  14. cnt+= 1;
  15. // Get the row current row using the name of the grid and the row
  16. // number from our counter so we can check it for a sibling
  17. row=igtbl_getRowById ( "UltraWebGrid1r_"+cnt )
  18. // Finally delete that row,
  19. igtbl_deleteRow ( "UltraWebGrid1", "UltraWebGrid1r_"+cnt );
  20. }
  21. }
//可用的例子
  1. function DeleteRow ( ) {
  2. var grid = igtbl_getGridById ( "<%= uwgList.ClientID % >" );
  3. var grna=document. getElementById ( "<%=uwgList.ClientID %>" ). name;
  4. var rowsLenght = grid. Rows. length;
  5. for ( var i = 0; i < rows. Lenght; i++ ) {
  6. igtbl_deleteRow (grna,grna+ "_r_"+i );
  7. }
  8. }
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值