有没有办法测试jqGrid是否有数据? [英] Is there a way to test if jqGrid has data or not?

查看:73
本文介绍了有没有办法测试jqGrid是否有数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在jqgrid上启用和禁用自定义按钮,但只有在网格为空时才启用该按钮,然后在没有时禁用。

I'm trying to enable and disable custom buttons on a jqgrid, but would enable that button only if the grid is empty and then disable when its not.

有没有办法测试网格是否有数据?

Is there a way to test of the grid has data or not?

谢谢。

推荐答案

您可以测试以查看网格中有多少条记录。如果没有行则网格为空:

You can test to see how many records are in the grid. If there are no rows then the grid is empty:

jQuery('#grid').jqGrid('getGridParam', 'reccount');

请参阅 reccount


Readonly属性。确定网格中的确切行数。

Readonly property. Determines the exactly number of rows in the grid.

此外,由于默认值为 0 您需要确保在加载数据后调用此函数,例如在 loadComplete 事件中。

Also, since the default value is 0 you need to make sure you call this function after data has loaded, such as in the loadComplete event.

这篇关于有没有办法测试jqGrid是否有数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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