!function(t){"use strict";"function"==typeof define&&define.amd?define(["jquery","./grid.base"],t):"object"==typeof module&&module.exports?module.exports=function(e,r){return e||(e=window),void 0===r&&(r="undefined"!=typeof window?require("jquery"):require("jquery")(e)),require("./grid.base"),t(r),r}:t(jQuery)}(function(T){"use strict";var S=T.jgrid,u=S.getAccessor,f=S.stripPref,v=S.jqID,k=T.fn.jqGrid,n=function(){var e=T.makeArray(arguments);return e[0]="treeGrid"+e[0].charAt(0).toUpperCase()+e[0].substring(1),e.unshift(""),e.unshift(""),e.unshift(this.p),S.feedback.apply(this,e)},o=function(e,r){var t=r[e.treeReader.icon_field],a=e.treeIcons,i=a.plus+" tree-plus",d=a.minus+" tree-minus";return t&&"string"==typeof t&&2===(t=t.split(",")).length&&(d=t[0],i=t[1]),{expanded:d,collapsed:i,common:a.commonIconClass}};S.extend({setTreeNode:function(){return this.each(function(){var e=this,n=T(e),o=e.p;if(e.grid&&o.treeGrid){var s=o.treeReader.expanded_field,c=o.treeReader.leaf_field;n.off("jqGridBeforeSelectRow.setTreeNode"),n.on("jqGridBeforeSelectRow.setTreeNode",function(e,t,r){if(null!=r){var a=T(r.target),i=a.closest("tr.jqgrow>td"),d=i.parent(),l=function(){var e=o.data[o._index[f(o.idPrefix,t)]],r=e[s]?"collapse":"expand";e[c]||(k[r+"Row"].call(n,e,d),k[r+"Node"].call(n,e,d))};return a.is("div.treeclick")?l():o.ExpandColClick&&0c)return d=this,!1}),d}if(null===i||"null"===i)return null;var h=t._index[i];return void 0!==h?t.data[h]:null},getNodeChildren:function(s){var c=[];return this.each(function(){var e=this.p;if(this.grid&&e.treeGrid)switch(e.treeGridModel){case"nested":var r=e.treeReader.left_field,t=e.treeReader.right_field,a=e.treeReader.level_field,i=parseInt(s[r],10),d=parseInt(s[t],10),l=parseInt(s[a],10);T(e.data).each(function(){parseInt(this[a],10)===l+1&&parseInt(this[r],10)>i&&parseInt(this[t],10)=n&&parseInt(this[t],10)>=d&&parseInt(this[t],10)<=l&&f.push(this)});break;case"adjacency":if(c){f.push(c);var o=e.treeReader.parent_id_field,s=e.localReader.id;T(e.data).each(function(){var e;for(r=f.length,e=0;etbody>tr#"+v(r)))})}})},collectChildrenSortTree:function(n,o,s,c,f,h){return this.each(function(){var e=T(this);if(this.grid&&this.p.treeGrid){var r,t,a,i=k.getNodeChildren.call(e,o),d=S.from.call(this,i);d.orderBy(s,c,f,h);var l=d.select();for(r=0,t=l.length;rl?parseInt(I[m][_],10)+2:I[m][_],I[m][R]=I[m][R]>=l?parseInt(I[m][R],10)+2:I[m][R]);j[_]=l,j[R]=l+1}else{if(l=parseInt(k.getCol.call(s,R,!1,"max"),10),(I=S.from.call(n,o.data).greater(_,l,{stype:"integer"}).select()).length)for(m in I)I.hasOwnProperty(m)&&(I[m][_]=parseInt(I[m][_],10)+2);if((I=S.from.call(n,o.data).greater(R,l,{stype:"integer"}).select()).length)for(m in I)I.hasOwnProperty(m)&&(I[m][R]=parseInt(I[m][R],10)+2);j[_]=l+1,j[R]=l+2}(null===P||k.isNodeLoaded.call(s,t)||d)&&k.addRowData.call(s,b,j,e,h),t&&!t[p]&&M&&T(n.rows[x]).find("div.treeclick").click()}})}})}); //# sourceMappingURL=grid.treegrid.js.map