[RESOLVED]get the selected rows first field id value for jqgrid using jquery

hi

i need a cell value for selected rows  first field id value for jqgrid using jquery

please someone help for me.

In JavaScript:

var rowid = $('#YourGridId').jqGrid('getGridParam', 'selrow');

// assign the value from a cell in the selected grid row to a variable of your choice:
var YourCellValue = $('#YourGridId').jqGrid('getCell', rowid, 'YourCellId')

alert(YourCellValue);

thanks for u reply

how to call on select row function for jqgrid in jquery.

Hi Ananth,

Sample for onSelectRow

 $(document).ready(function() {
        $(function() {
            $('#Listing').jqGrid({
                url: '@Url.Action("Grid", "Name")',
                datatype: "json",
                edit: false,
                add: false,
                del: false,
                height: 330,
                mtype: 'GET',
                colNames: ['ID','Name'],
                jsonReader: {
                    root: "Clients",
                    page: "CurrentPage",
                    total: "TotalPages",
                    records: "TotalRecords",
                    repeatitems: false,
                    cell: "",
                    id: "0"
                },
                colModel: [
                    { name: 'Id', index: 'Id', width: 65, align: 'center', sorttype: "int" },
                    { name: '@NameMap.STATUS_COLUMN', index: '@NameMap.STATUS_COLUMN', width: 140, align: 'left', sortable: true }],
                pager: '#pager',
                rowNum: 10,
                rowList: [10, 15, 20],
                sortname: 'Id',
                sortorder: 'asc',
                viewrecords: true,
                gridview: true,                    
                onSelectRow: function (id) {
                        $.ajax({
                                url: '@Url.Action("Details","Name")',
                                data: { 'Id': id },
                                success: function (detailsHtml) {
                                         $('#NameDetails').html(detailsHtml);
                                         },
                                dataType: 'html'
                                });
                        },
                loadComplete: function () {
                              $('#NameDetails').html("");
                             }  
            });
        });
    });

k thank you

i get back to you soon……

Leave a Reply