Yugandhar Yugandhar - 1 year ago 194
Javascript Question

How to get key and values of particular of jqGrid

I have one jqGrid like below(part of the code)

$(function() {
options = $("#pdbconfiggrid").jqGrid({
datatype: 'json',
mtype: 'GET',
colNames:['Display Name','Property Name', 'Property Value', 'Group Type'],
{name:'display_name',index:'key',editable:false,sortable:false, width:30},
{name:'key',index:'_key', hidden:true},
{name:'value',index:'value', editable:false,sortable:false, width:100, formatter:returnPropertyValue},
{name:'group',index:'group',sortable:false, hidden:true, width:30},
postData: {},
rowNum: -1,
height: 'auto',
autowidth: true,
viewrecords: false,
toppager: false,
emptyrecords: "Empty records",
cmTemplate: { title: false},
loadonce: false,
altRows: true,
sortname: 'index',
sortorder: "asc",
groupingView : {
groupField : ['group'],
groupColumnShow : [false],
groupCollapse : true,
groupSorted: false,
groupDataSorted: false

I am setting multiple group values(like A,B,C,D) for this grid.
Now , how can i get all key & values of particular group on given grop name
like jqGrid.getGroupData("A");


Answer Source

I have tried like this. and it works

  function getGroupData(group_name) {
var rowData;
var complete_data = jQuery("#syncconfiggrid").jqGrid('getRowData');
var group_data = {};
for (var index in complete_data) {
    rowData = complete_data[index];
    if (group_name == rowData.group) {
        var prop_key = rowData.key;
        if (null != prop_key && prop_key.length > 2)
            group_data[prop_key] = $('#' + prop_key.replaceAll(".", "_")).val(); // this is my code specific
return group_data;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download