最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

php - JQGrid: get multiple checked row values in JQGrid by post - Stack Overflow

programmeradmin5浏览0评论

I have one JQGrid in my php file and I have placed inside one form . On submitting form, i just want the checked value from the 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>  

And I have used the following code to get the checked value , But All stuff are made in java script. But I have to get the values for updating the database. So i need to get the value by post.

Please provide me the methods..

I have one JQGrid in my php file and I have placed inside one form . On submitting form, i just want the checked value from the 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>  

And I have used the following code to get the checked value , But All stuff are made in java script. But I have to get the values for updating the database. So i need to get the value by post.

Please provide me the methods..

Share Improve this question edited Apr 12, 2012 at 11:10 Sridhar asked Apr 12, 2012 at 9:46 SridharSridhar 2,22811 gold badges49 silver badges80 bronze badges 3
  • I want to get checked name and mobile no on form submitting – Sridhar Commented Apr 12, 2012 at 9:53
  • @oleg I use your code for getting select all(check all option) in JQGrid. Now I require how to get the checked value from the JQGrid by post/get. – Sridhar Commented Apr 12, 2012 at 12:14
  • If you would like to post a message to my you should write a comment with @Oleg in one of my old answers. The above comment made no notification to me, so I found it occasionally. – Oleg Commented Apr 12, 2012 at 16:02
Add a comment  | 

1 Answer 1

Reset to default 21

You should use

var selRowIds = myGrid.jqGrid ('getGridParam', 'selarrrow');

insteda of

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

to get the array with ids of selected rows. You can use JSON.stringify(selRowIds) or selRowIds.join(',') to convert array in the form which you can easy send to the server.

I think that you can find some additional information in the answer (see the demo).

发布评论

评论列表(0)

  1. 暂无评论