设置JQGrid,以便所有行都是可编辑的吗? [英] Set up JQGrid so all rows are editable?

查看:171
本文介绍了设置JQGrid,以便所有行都是可编辑的吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想制作一个JQGrid,其中所有行始终都是可编辑的(行内).这样做的首选方法是什么?我在想只需要遍历行并在每行上调用grid.editRow(id, true);但是到目前为止,我什至还没有想出如何访问行集合来做到这一点.

I'd like to make a JQGrid where all rows are editable (in-line) all the time. What would be the preferred approach to doing this? I'm thinking I'll need to just iterate through the rows and call grid.editRow(id, true) on each one; but at this point I haven't even figured out how to get access to a collection of rows in order to do that.

推荐答案

您可以通过检索网格中每一行的所有ID的列表来遍历所有行.然后循环浏览列表:

You can loop through all of the rows by retrieving a list of all ID's for each row in the grid. Then just loop through the list:

    var ids = grid.getDataIDs();
    for (var i = 0; i < ids.length; i++) {
        grid.editRow(ids[i], true);
    };

您可能可以调用editRow来使行可编辑,但是要注意,在内部,editRow会将焦点设置为每行变为可编辑状态.因此,如果您的网格具有滚动条,则该网格将一次一次地在各行中滚动.

You can probably call editRow to make the rows editable, however be aware that internally, editRow will set focus to each row as it becomes editable. Thus if your grid has a scrollbar the grid will visibly scroll through the rows one-at-a-time.

这篇关于设置JQGrid,以便所有行都是可编辑的吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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