加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

php – JQGrid:通过post在JQGrid中获取多个选中的行值

发布时间:2020-12-13 18:18:47 所属栏目:PHP教程 来源:网络整理
导读:我的php文件中有一个JQGrid,我放在一个表单中.在提交表单时,我只想要来自JQGrid的检查值. script type="text/javascript" $(function() { $("#list1").jqGrid({ url:'revMemberJson.php',datatype: 'json',mtype: 'GET',loadonce: true,// jsonReader: { rep
我的php文件中有一个JQGrid,我放在一个表单中.在提交表单时,我只想要来自JQGrid的检查值.
<script type="text/javascript">
    $(function() {
        $("#list1").jqGrid({
            url:'revMemberJson.php',datatype: 'json',mtype: 'GET',loadonce: true,// jsonReader: { repeatitems: false },colNames:['Name','Mobile'],colModel :[ 
                {name:'name',index:'name',width: 100,searchoptions: { sopt: ['eq','ne','cn']}},{name:'mobile',index:'mobile',search: false,width: 120}
            ],pager: '#pager',rowNum: 5,rowList:[5,20,30],rownumbers: true,multiselect:true,sortname: 'id',sortorder: 'desc',viewrecords: true,height: 'auto',width: 420,shrinkToFit: false,gridview: true,caption: 'Members'
        });
        jQuery("#list1").jqGrid('navGrid','#pager',{edit:false,add:false,del:false});

    });

    var myGrid = $('#list1'),selRowId = myGrid.jqGrid ('getGridParam','selrow'),celValue = myGrid.jqGrid ('getCell',selRowId,'mobile');

</script>

我使用以下代码来获取检查值,但所有内容都是用java脚本编写的.但我必须获得更新数据库的值.所以我需要通过邮寄获得价值.

请提供方法..

你应该用
var selRowIds = myGrid.jqGrid ('getGridParam','selarrrow');

insteda

var selRowId = myGrid.jqGrid ('getGridParam','selrow');

获取包含所选行的ID的数组.您可以使用JSON.stringify(selRowIds)或selRowIds.join(‘,’)以您可以轻松发送到服务器的形式转换数组.

我想你可以在the answer找到一些额外的信息(见the demo).

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读