;(function($){
/**
* jqGrid extension for SubGrid Data
* Tony Tomov tony@trirand.com
* http://trirand.com/blog/
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
**/
$.fn.extend({
addSubGrid : function(t,row,pos,rowelem) {
return this.each(function(){
var ts = this;
if (!ts.grid ) {
return;
}
var td, res,_id, pID, nhc, bfsc;
td = document.createElement("td");
$(td,t).html("
").addClass("sgcollapsed")
.click( function(e) {
if($(this).hasClass("sgcollapsed")) {
pID = $("table:first",ts.grid.bDiv).attr("id");
res = $(this).parent();
var atd= pos==1?'

").removeClass("sgcollapsed").addClass("sgexpanded");
} else if($(this).hasClass("sgexpanded")) {
bfsc = true;
if( $.isFunction(ts.p.subGridRowColapsed)) {
res = $(this).parent();
_id = $(res).attr("id");
bfsc = ts.p.subGridRowColapsed(pID+"_"+_id,_id );
};
if(bfsc===false) {return false;}
$(this).parent().next().remove(".subgrid");
$(this).html("
").removeClass("sgexpanded").addClass("sgcollapsed");
}
return false;
});
row.appendChild(td);
//-------------------------
var populatesubgrid = function( rd ) {
var res,sid,dp;
sid = $(rd).attr("id");
dp = {id:sid, nd_: (new Date().getTime())};
if(!ts.p.subGridModel[0]) {
return false;
}
if(ts.p.subGridModel[0].params) {
for(var j=0; j < ts.p.subGridModel[0].params.length; j++) {
for(var i=0; i
").removeClass("sgcollapsed").addClass("sgexpanded");
} else if($(this).hasClass("sgexpanded")) {
bfsc = true;
if( $.isFunction(ts.p.subGridRowColapsed)) {
res = $(this).parent();
_id = $(res).attr("id");
bfsc = ts.p.subGridRowColapsed(pID+"_"+_id,_id );
};
if(bfsc===false) {return false;}
$(this).parent().next().remove(".subgrid");
$(this).html("
").removeClass("sgexpanded").addClass("sgcollapsed");
}
return false;
});
row.appendChild(td);
//-------------------------
var populatesubgrid = function( rd ) {
var res,sid,dp;
sid = $(rd).attr("id");
dp = {id:sid, nd_: (new Date().getTime())};
if(!ts.p.subGridModel[0]) {
return false;
}
if(ts.p.subGridModel[0].params) {
for(var j=0; j < ts.p.subGridModel[0].params.length; j++) {
for(var i=0; i