jqgrid删除网格内的所有行 [英] jqgrid delete all rows inside grid

查看:159
本文介绍了jqgrid删除网格内的所有行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法删除一个函数调用中的所有行?而不是循环遍历所有行并逐行删除。

Is there a way to delete all rows in one function call? and not by looping through all rows and deleting row by row.

感谢提前。

推荐答案

这取决于你在删除所有行中的确切含义。在许多情况下, GridUnload 的方法可能非常有用,但它只删除了网格包含的内容。

It's depend on what you exactly mean under "deleting of all rows". The method GridUnload could be very helpful in many cases, but it delete more as only grid contain.

jqGrid中使用的另一种实习方法是:

Another method used intern in jqGrid is:

var trf = $("#list tbody:first tr:first")[0];
$("#list tbody:first").empty().append(trf);

可能这就是你所需要的。除了第一行之外,它删除所有网格行。您也可以覆盖以下代码

Probably it is what you need. It delete all grid rows excepting of the first one. You can overwrite the code also as the following

var myGrid = $("#list"); // the variable you probably have already somewhere
var gridBody = myGrid.children("tbody");
var firstRow = gridBody.children("tr.jqgfirstrow");
gridBody.empty().append(firstRow);

这篇关于jqgrid删除网格内的所有行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆