Sangeetha Krishnan
Sangeetha Krishnan

Reputation: 1001

Getting jqGrid group column header values

I am using jquery 1.7.1. I am using group headers in jqGrid. i can get the column names using this code $("#_My_Grid").jqGrid('getGridParam','colNames');. Like this how can i get group header column names? i have shown group headers in my grid by using this code

$("#_My_Grid").jqGrid('setGroupHeaders', {
    useColSpanStyle: false, 
    groupHeaders:[   
        {startColumnName: 'amount', numberOfColumns: 3, titleText: 'Price'},
        {startColumnName: 'closed', numberOfColumns: 2, titleText: 'Shipping'}
    ]
});

I just want the values Price,Shipping. Can anybody resolve this..

Upvotes: 1

Views: 5717

Answers (1)

Oleg
Oleg

Reputation: 222007

The options of of setGroupHeaders method will be saved in internal groupHeader option of jqGrid. So you can use the following code to access the values "Price" and "Shipping":

var groupHeadersOptions = $("#_My_Grid").jqGrid("getGridParam", "groupHeader"));
alert(groupHeadersOptions.groupHeaders[0].titleText); // displays "Price"
alert(groupHeadersOptions.groupHeaders[1].titleText); // displays "Shipping"

Upvotes: 1

Related Questions