在客户端删除UltraWebGrid的所有行

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

//帮助中的例子,不可用
  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.         }
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值