I use free jqgrid(v5.1.1) in my asp.net mvc project. In my view,I have 5 level hierarchical jqgrid. how can I set background color of header of each level? for example header of first level has "blue" color,second level has "green" color,third level has "light blue" color and....
here is my code:
//************************************fill grid level 1 **********************************
function FillJQueryGrid(ProjectIdVal) {
$("#jqGrid").jqGrid({
url: '@Url.Action("GetCodingCodeSumLists", "Report")' + '?ProjectId=' + ProjectIdVal,// jqgrid_data,
jsonReader: {
repeatitems: false,
root: function (obj) {
return obj.records;
}
},
datatype: "json",
height: 'auto',
page: 1,
colModel: [
{ label: 'Fieco Doc No.', name: 'comp_code', key: true},
{ label: 'Subject', name: 'Comp_Subject' },
{ label: 'Delay', name: 'sum_delay_count' },
],
width:"100%",
loadonce: true,
autowidth: true,
rowNum: 20,
subGrid: true,
subGridRowExpanded: showChildGridrevision,
pager: "#jqGridPager"
});
};
//***********************************fill grid level 2 *******************************************
function showChildGridrevision(parentRowID, parentRowKey) {
var childGridID = parentRowID + "_table";
var childGridPagerID = parentRowID + "_pager";
var childGridURL = '@Url.Action("GetRevisionSumLists", "Report")' + '?CompCode=' + parentRowKey;
$('#' + parentRowID).append('<table id=' + childGridID + '></table><div id=' + childGridPagerID + ' class=scroll></div>');
$("#" + childGridID).jqGrid({
url: childGridURL,
jsonReader: {
repeatitems: false,
root: function (obj) {
return obj.records;
}
},
datatype: "json",
height: 'auto',
width: "100%",
page: 1,
colModel: [
{label:'CompCode_Revision',name:'CompCode_Revision',key:true,hidden:true},
{ label: 'comp_code', name: 'comp_code', hidden: true },
{ label: 'revision', name: 'revision',width:500 },
{ label: 'Delay', name: 'sum_delay_count',width:500 }
],
loadonce: true,
subGrid: true,
subGridRowExpanded: showChildGridTransmital,
pager: "#" + childGridPagerID
});
}
//***********************************fill grid level 3 *******************************************
function showChildGridTransmital(parentRowID2, parentRowKey2) {
debugger;
var childGridID2 = parentRowID2 + "_table";
var childGridPagerID2 = parentRowID2 + "_pager";
var childGridURL2 = '@Url.Action("GetTransmitalSumLists", "Report")' + '?CompCode_Revision=' + parentRowKey2;
$('#' + parentRowID2).append('<table id=' + childGridID2 + '></table><div id=' + childGridPagerID2 + ' class=scroll></div>');
$("#" + childGridID2).jqGrid({
url: childGridURL2,
jsonReader: {
repeatitems: false,
root: function (obj) {
return obj.records;
}
},
datatype: "json",
height:'auto',
page: 1,
colModel: [
{ label: 'CompCode_Revision_Transmital', name: 'CompCode_Revision_Transmital', key: true,hidden:true},
{ label: 'CompCode_Revision', name: 'CompCode_Revision', hidden: true },
{ label: 'transmital no', name: 'trans_ref_no' ,width:200},
{ label: 'transmital subject', name: 'ChkMain_Subject' ,width:400},
{ label: 'transmital date', name: 'trans_date',width:200 },
{ label: 'Delay', name: 'sum_delay_count',width:200 }
],
width:'100%',
loadonce: true,
subGrid: true,
subGridRowExpanded: showChildGridReceiver,
pager: "#" + childGridPagerID2
});
}
//***********************************fill grid level 4 *******************************************
function showChildGridReceiver(parentRowID, parentRowKey) {
debugger;
var childGridID = parentRowID + "_table";
var childGridPagerID = parentRowID + "_pager";
var childGridURL = '@Url.Action("GetReceiverSumLists", "Report")' + '?CompCode_Revision_Transmital=' + parentRowKey;
$('#' + parentRowID).append('<table id=' + childGridID + '></table><div id=' + childGridPagerID + ' class=scroll></div>');
$("#" + childGridID).jqGrid({
url: childGridURL,
jsonReader: {
repeatitems: false,
root: function (obj) {
return obj.records;
}
},
datatype: "json",
page: 1,
colModel: [
{ label: 'CompCode_Revision_Transmital_receiver', name: 'CompCode_Revision_Transmital_receiver', key: true, hidden: true },
{ label: 'receiver_id', name: 'receiver_id',hidden:true },
{ label: 'Receiver Name', name: 'receiver_name',width:500 },
{ label: 'Delay', name: 'sum_delay_count', width: 500 }
],
loadonce: true,
height: '100%',
subGrid: true,
subGridRowExpanded: showChildGridLetter,
pager: "#" + childGridPagerID
});
}
//***********************************fill grid level 5 *******************************************
function showChildGridLetter(parentRowID, parentRowKey) {
debugger;
var childGridID = parentRowID + "_table";
var childGridPagerID = parentRowID + "_pager";
var childGridURL = '@Url.Action("GetLettersOfCodingWithDelayLists", "Report")' + '?CompCode_Revision_Transmital_Receiver=' + parentRowKey;
$('#' + parentRowID).append('<table id=' + childGridID + '></table><div id=' + childGridPagerID + ' class=scroll></div>');
$("#" + childGridID).jqGrid({
url: childGridURL,
jsonReader: {
repeatitems: false,
root: function (obj) {
return obj.records;
}
},
datatype: "json",
page: 1,
colModel: [
{ label: 'DCC_letter_id', name: 'DCC_letter_id', key: true, hidden: true },
{ label: 'CommentLetter No', name: 'Let_no'},
{ label: 'Subject', name: 'Let_subject' ,width:300},
{ label: 'Estimate Date', name: 'estimate_date_of_letter' },
{ label: 'Send Date', name: 'Let_date' },
{ label: 'Delay', name: 'delay_count_of_letter'}
],
loadonce: true,
height: '100%',
subGrid: false,
pager: "#" + childGridPagerID
});
}