template.js.plugins.grid.treegrid.min.js Maven / Gradle / Ivy
'use strict';(function(g){"function"===typeof define&&define.amd?define(["jquery","./grid.base"],g):"object"===typeof module&&module.exports?module.exports=function(p,t){p||(p=window);void 0===t&&(t="undefined"!==typeof window?require("jquery"):require("jquery")(p));require("./grid.base");g(t);return t}:g(jQuery)})(function(g){var p=g.jgrid,t=p.getAccessor,D=p.stripPref,y=p.jqID,l=g.fn.jqGrid,u=function(){var a=g.makeArray(arguments);a[0]="treeGrid"+a[0].charAt(0).toUpperCase()+a[0].substring(1);
a.unshift("");a.unshift("");a.unshift(this.p);return p.feedback.apply(this,a)},z=function(a,b){b=b[a.treeReader.icon_field];a=a.treeIcons;var c=a.plus+" tree-plus",f=a.minus+" tree-minus";b&&"string"===typeof b&&(b=b.split(","),2===b.length&&(f=b[0],c=b[1]));return{expanded:f,collapsed:c,common:a.commonIconClass}};p.extend({setTreeNode:function(){return this.each(function(){var a=g(this),b=this.p;if(this.grid&&b.treeGrid){var c=b.treeReader.expanded_field,f=b.treeReader.leaf_field;a.off("jqGridBeforeSelectRow.setTreeNode");
a.on("jqGridBeforeSelectRow.setTreeNode",function(d,h,k){if(null!=k){d=g(k.target);k=d.closest("tr.jqgrow\x3etd");var e=k.parent(),r=function(){var d=b.data[b._index[D(b.idPrefix,h)]],g=d[c]?"collapse":"expand";d[f]||(l[g+"Row"].call(a,d,e),l[g+"Node"].call(a,d,e))};d.is("div.treeclick")?r():b.ExpandColClick&&0n)return d=this,!1});return d}if(null===f||"null"===f)return null;a=b._index[f];return void 0!==a?b.data[a]:null},getNodeChildren:function(a){var b=[];this.each(function(){var c=this.p;if(this.grid&&c.treeGrid)switch(c.treeGridModel){case "nested":var f=c.treeReader.left_field,d=c.treeReader.right_field,h=c.treeReader.level_field,k=parseInt(a[f],10),e=parseInt(a[d],10),l=parseInt(a[h],10);g(c.data).each(function(){parseInt(this[h],10)===l+1&&parseInt(this[f],10)>k&&parseInt(this[d],10)=n&&parseInt(this[d],
10)>=e&&parseInt(this[d],10)<=l&&b.push(this)});break;case "adjacency":if(a){b.push(a);var m=c.treeReader.parent_id_field,p=c.localReader.id;g(c.data).each(function(){var a;f=b.length;for(a=0;at&&(t=G,u=H)}m[B]&&(y=!0,m[A]=!0,g(this.rows[I]).find("span.cell-wrapperleaf").removeClass("cell-wrapperleaf").addClass("cell-wrapper").end().find("div.tree-leaf").removeClass(d.treeIcons.leaf+" tree-leaf").addClass(d.treeIcons.commonIconClass).addClass(e),d.data[n][B]=!1,m[E]=!0)}void 0===c[A]&&(c[A]=!1);void 0===c[E]&&(c[E]=!1);c[z]=w;void 0===
c[B]&&(c[B]=!0);"adjacency"===d.treeGridModel&&(c[D]=b);if("nested"===d.treeGridModel){var q;if(null!==b){k=parseInt(m[v],10);d=p.from.call(this,d.data);d=d.greaterOrEquals(v,k,{stype:"integer"});e=d.select();if(e.length)for(q in e)e.hasOwnProperty(q)&&(e[q][x]=e[q][x]>k?parseInt(e[q][x],10)+2:e[q][x],e[q][v]=e[q][v]>=k?parseInt(e[q][v],10)+2:e[q][v]);c[x]=k;c[v]=k+1}else{k=parseInt(l.getCol.call(h,v,!1,"max"),10);e=p.from.call(this,d.data).greater(x,k,{stype:"integer"}).select();if(e.length)for(q in e)e.hasOwnProperty(q)&&
(e[q][x]=parseInt(e[q][x],10)+2);e=p.from.call(this,d.data).greater(v,k,{stype:"integer"}).select();if(e.length)for(q in e)e.hasOwnProperty(q)&&(e[q][v]=parseInt(e[q][v],10)+2);c[x]=k+1;c[v]=k+2}}(null===b||l.isNodeLoaded.call(h,m)||y)&&l.addRowData.call(h,a,c,r,u);m&&!m[A]&&f&&g(this.rows[I]).find("div.treeclick").click()}})}})});
//# sourceMappingURL=grid.treegrid.min.js.map
© 2015 - 2025 Weber Informatics LLC | Privacy Policy