/*!@license
 * Infragistics.Web.ClientUI Hierarchical Grid 15.2.20152.1027
 *
 * Copyright (c) 2011-2015 Infragistics Inc.
 *
 * http://www.infragistics.com/
 *
 * Depends on:
 *	jquery-1.4.4.js
 *	jquery.ui.core.js
 *	jquery.ui.widget.js
 *	infragistics.dataSource.js
 *	infragistics.ui.shared.js
 *	infragistics.util.js
 *	infragistics.ui.grid.framework.js
 */
(function($){$.widget("ui.igHierarchicalGrid",{css:{expandColumn:"ui-iggrid-expandcolumn",expandColumnExpanded:"ui-iggrid-expandcolumn-expanded",expandButton:"ui-iggrid-expandbutton ui-icon-plus",expandButtonHover:"ui-iggrid-expandbuttonhover ui-icon-plus ui-state-hover",expandButtonExpandedHover:"ui-iggrid-expandbuttonexpandedhover ui-icon-plus ui-state-hover",expandButtonExpanded:"ui-iggrid-expandbutton ui-iggrid-expandbuttonexpanded ui-icon-minus",expandButtonClick:"ui-iggrid-expandbuttonclick ui-icon-plus",childGridArea:"ui-iggrid-childarea",childGridAreaCollapsed:"ui-iggrid-childarea-collapsed",expandHeaderCell:"ui-iggrid-expandheadercell ui-iggrid-header ui-widget-header",expandHeaderCellTriangle:"ui-icon ui-icon-triangle-1-se",root:"ui-iggrid-root",childGridSeparator:"ui-iggrid-childgridseparator"},options:{initialDataBindDepth:-1,initialExpandDepth:-1,odata:false,rest:false,maxDataBindDepth:-1,defaultChildrenDataProperty:"children",autoGenerateLayouts:false,expandCollapseAnimations:true,expandColWidth:30,pathSeparator:"/",animationDuration:500,expandTooltip:$.ig.Grid.locale.expandTooltip,collapseTooltip:$.ig.Grid.locale.collapseTooltip,columns:[],columnLayouts:[{key:null,primaryKey:null,foreignKey:null}]},events:{rowExpanding:"rowExpanding",rowExpanded:"rowExpanded",rowCollapsing:"rowCollapsing",rowCollapsed:"rowCollapsed",childrenPopulating:"childrenPopulating",childrenPopulated:"childrenPopulated",childGridRendered:"childGridRendered",childGridCreating:"igchildgridcreating",childGridCreated:"igchildgridcreated"},_setOption:function(key,value){if(key==="dataSource"){this.options.dataSource=value;this.dataBind()}else if(key==="initialDataBindDepth"||key==="initialExpandDepth"||key==="expandColWidth"){throw new Error($.ig.Grid.locale.optionChangeNotSupported.replace("{optionName}",key))}if(key==="odata"||key==="defaultChildrenDataProperty"||key==="expandTooltip"||key==="collapseTooltip"||key==="autoGenerateLayouts"||key==="expandCollapseAnimations"||key==="animationDuration"){$.Widget.prototype._setOption.apply(this,arguments)}else if(this.rootWidget()&&key!=="dataSource"){this.rootWidget()._setOption(key,value)}},_create:function(){this._regevents(this.element,this);$.ui.igGrid.prototype.options.columns=[];$.ui.igGrid.prototype.options.features=[];this.options=$.extend(true,{},$.ui.igGrid.prototype.options,this.options);if(this.tmpDataSource!==null&&this.tmpDataSource!==undefined){this.options.dataSource=this.tmpDataSource;this._originalOptions.dataSource=this.tmpDataSource}if(this.options.virtualization===true||this.options.rowVirtualization===true){this.options.virtualizationMode="continuous"}this._eventQueue=[];this._animationQueue=[];this.dataBind();this.rootWidget()._isMultiColumnGrid=this._checkIsMultiColumnHeader(this.options)},_createWidget:function(options){this.options.columns=[];this.options.features=[];this.options.columnLayouts=[];if(options.dataSource&&($.type(options.dataSource)==="array"||$.type(options.dataSource)==="object")){this.tmpDataSource=options.dataSource;options.dataSource=null;this._originalOptions=options}$.Widget.prototype._createWidget.apply(this,arguments)},dataBind:function(){var hds,hdsoptions,rootds,opts;if(this.options.autoGenerateLayouts){this._generateLayouts()}hdsoptions=this._hdsoptions();hds=new $.ig.HierarchicalDataSource(hdsoptions);this._hds=hds;rootds=this._hds.root();this._tmpds=this.options.dataSource;this.options.dataSource=null;opts=$.extend(true,{},this.options);this.options.dataSource=this._tmpds;this._tmpds=null;opts.dataSource=rootds;if($.type(hdsoptions.dataSource)==="string"){opts.dataSourceUrl=hdsoptions.dataSource}if(!this._columnsGeneratedHandler){this._columnsGeneratedHandler=$.proxy(this._columnsGenerated,this)}else{this.element.unbind("iggridcolumnsgenerated",this._columnsGeneratedHandler)}this.element.bind("iggridcolumnsgenerated",this._columnsGeneratedHandler);if(this.options.autoGenerateLayouts===true){if(!this._databoundHandler){this._databoundHandler=$.proxy(this._layouts,this)}else{this.element.unbind("iggridcolumnsgenerated",this._databoundHandler)}this.element.bind("iggriddatarendering",this._databoundHandler)}this.element.addClass(this.css.root);this.element.attr("data-level",0);opts._isHierarchicalGrid=true;if(this._root){this._root.igGrid("option","dataSource",opts.dataSource)}else{if(this.options.autoGenerateLayouts===true){opts._recurseSchema=true}this._root=this.element.igGrid(opts)}if(this.rootWidget().container().data("igLoading")){this.indicator=this.rootWidget().container().data("igLoading").indicator()}else{this.indicator=this.rootWidget().container().igLoading().data("igLoading").indicator()}this._regToggleEvent(this.element,this)},_generateLayouts:function(){var rec,i,ds=this.options.dataSource;if($.type(ds)!=="array"&&$.type(ds)!=="object"||ds.length===0){return}if($.type(ds)==="object"&&this.options.responseDataKey){ds=ds[this.options.responseDataKey]||ds}for(i=0;i<ds.length;i++){rec=ds[i];this._generateLayout(rec,this.options)}},_generateLayout:function(record,options){var name,layout,tmpLayout,i,rec,hasRespKey=false;for(name in record){if(record.hasOwnProperty(name)&&($.type(record[name])==="array"||$.type(record[name])==="object"&&options.responseDataKey&&$.type(record[name][options.responseDataKey])==="array")){rec=record[name];if(options.responseDataKey&&$.type(rec)==="object"){if(rec[options.responseDataKey]&&$.type(rec[options.responseDataKey])==="array"){rec=rec[options.responseDataKey];hasRespKey=true}else{continue}}layout={key:name,childrenDataProperty:name,columnLayouts:[]};if(hasRespKey){layout.responseDataKey=options.responseDataKey}tmpLayout=this._layoutExistsRecursive(this.options,name);if(!tmpLayout){if(options.columnLayouts===undefined||options.columnLayouts===null){options.columnLayouts=[]}options.columnLayouts.push(layout)}else{layout=tmpLayout}if(rec.length>0){for(i=0;i<rec.length;i++){this._generateLayout(rec[i],layout)}}}}},_layoutExistsRecursive:function(options,key){var i,tmpLayout=null;tmpLayout=options.key===key?options:tmpLayout;if(!tmpLayout){for(i=0;options.columnLayouts&&i<options.columnLayouts.length;i++){tmpLayout=this._layoutExistsRecursive(options.columnLayouts[i],key);if(tmpLayout){break}}}return tmpLayout},root:function(){return this._root},rootWidget:function(){return this.root().data("igGrid")},allChildrenWidgets:function(){return this.root().find(".ui-iggrid-table").map(function(){return $(this).data("igGrid")})},allChildren:function(){return this.root().find(".ui-iggrid-table")},toggle:function(element,callback){this._toggleInternal({target:$(element).find(".ui-iggrid-expandcolumn")},true,callback)},expand:function(id,callback){if(!this.populated(id)){this._toggleInternal({target:$(id).find(".ui-iggrid-expandcolumn")},true,callback)}else{this._expand(id,true,callback)}},_expand:function(id,suppressEvents,callback){var tr=$(id),c,noCancel=true,handler,rootgrid;if(this.expanded(tr)){return}if(!suppressEvents){noCancel=this._trigger(this.events.rowExpanding,null,{owner:this,parentrow:tr})}if(this.expanded(tr)){return}rootgrid=this._rootgrid||this.element.closest(".ui-iggrid-root").data("igHierarchicalGrid");if(noCancel){if(this.options.expandCollapseAnimations){if(rootgrid._animationQueue[tr.attr("data-id")+"_"+tr.index()]===true){return}rootgrid._animationQueue[tr.attr("data-id")+"_"+tr.index()]=true}c=tr.find(".ui-iggrid-expandcolumn");tr.next().css("display","").css("visibility","visible");if(this.options.expandCollapseAnimations){if(!suppressEvents){handler=this._expandend}else{handler=this._expandendnoevents}tr.next().find("> td > div").slideDown(this.options.animationDuration,function(ctx){handler.apply(this,[ctx,callback])})}else{tr.next().find("> td > div").show();c.addClass(this.css.expandColumnExpanded).find(".ui-iggrid-expandbutton").removeClass(this.css.expandButton).addClass(this.css.expandButtonExpanded).attr("title",this.options.collapseTooltip)}tr.attr("state","e");tr.attr("aria-expanded",true);tr.next().children().first().removeClass(this.css.childGridAreaCollapsed).addClass(this.css.childGridArea);if(!this.options.expandCollapseAnimations){this._rowExpanded({owner:this,parentrow:tr});if(!suppressEvents){this._trigger(this.events.rowExpanded,null,{owner:this,parentrow:tr})}else if(callback){$.ig.util.invokeCallback(callback,[this,tr])}}}},expanded:function(element){var $e=element.length!==undefined?element:$(element);if($e===null||$e===undefined){return false}if($e.attr("state")!=="e"||$e.attr("state")===undefined){return false}return true},_expandendnoevents:function(ctx,callback){var expcell,expcellspan,rootgrid,$this=ctx?$(ctx):$(this),prow=$this.closest("tr[data-container]").prev();rootgrid=this._rootgrid||$this.closest(".ui-iggrid-root").data("igHierarchicalGrid");expcell=$this.closest("[data-container=true]").prev().find(".ui-iggrid-expandcolumn");expcellspan=expcell.find(".ui-iggrid-expandbutton");expcell.addClass(rootgrid.css.expandColumnExpanded);expcellspan.removeClass(rootgrid.css.expandButton).addClass(rootgrid.css.expandButtonExpanded).attr("title",rootgrid.options.collapseTooltip);rootgrid._rowExpanded({owner:rootgrid,parentrow:prow});if(rootgrid._animationQueue[prow.attr("data-id")+"_"+prow.index()]===true){delete rootgrid._animationQueue[prow.attr("data-id")+"_"+prow.index()]}if(callback){$.ig.util.invokeCallback(callback,[rootgrid,prow])}},_expandend:function(){var $this=$(this),rootgrid,prow=$this.closest("tr[data-container]").prev(),parentGrid=prow.closest(".ui-iggrid-table").data("igGrid");rootgrid=this._rootgrid||$this.closest(".ui-iggrid-root").data("igHierarchicalGrid");rootgrid._expandendnoevents(this);parentGrid._adjustLastColumnWidth(false);rootgrid._trigger(rootgrid.events.rowExpanded,null,{owner:rootgrid,parentrow:prow})},_collapseendnoevents:function(ctx,callback){var expcell,expcellspan,rootgrid,$this=ctx?$(ctx):$(this),ctd=$this.closest(".ui-iggrid-childarea"),prow=$this.closest("tr[data-container]").prev();rootgrid=this._rootgrid||$this.closest(".ui-iggrid-root").data("igHierarchicalGrid");ctd.removeClass(rootgrid.css.childGridArea).addClass(rootgrid.css.childGridAreaCollapsed);ctd.closest("tr").css("display","none").css("visibility","hidden");expcell=$this.closest("[data-container=true]").prev().find(".ui-iggrid-expandcolumn");expcellspan=expcell.find(".ui-iggrid-expandbutton");expcell.removeClass(rootgrid.css.expandColumnExpanded);expcellspan.removeClass(rootgrid.css.expandButtonExpanded).addClass(rootgrid.css.expandButton).attr("title",rootgrid.options.expandTooltip);if(rootgrid._animationQueue[prow.attr("data-id")+"_"+prow.index()]===true){delete rootgrid._animationQueue[prow.attr("data-id")+"_"+prow.index()]}if(callback){$.ig.util.invokeCallback(callback,[rootgrid,prow])}},_collapseend:function(){var $this=$(this),rootgrid,prow=$this.closest("tr[data-container]").prev(),parentGrid=prow.closest(".ui-iggrid-table").data("igGrid");rootgrid=this._rootgrid||$this.closest(".ui-iggrid-root").data("igHierarchicalGrid");rootgrid._collapseendnoevents(this);parentGrid._adjustLastColumnWidth(false);rootgrid._trigger(rootgrid.events.rowCollapsed,null,{owner:rootgrid,parentrow:prow})},collapse:function(id,callback){this._collapse(id,true,callback)},_collapse:function(id,suppressEvents,callback){var tr=$(id),c,noCancel=true,handler,rootgrid;if(this.collapsed(tr)){return}if(!suppressEvents){noCancel=this._trigger(this.events.rowCollapsing,null,{owner:this,parentrow:tr})}rootgrid=this._rootgrid||this.element.closest(".ui-iggrid-root").data("igHierarchicalGrid");if(noCancel){if(this.options.expandCollapseAnimations){if(rootgrid._animationQueue[tr.attr("data-id")+"_"+tr.index()]===true){return}rootgrid._animationQueue[tr.attr("data-id")+"_"+tr.index()]=true}c=tr.find(".ui-iggrid-expandcolumn");if(this.options.expandCollapseAnimations){if(!suppressEvents){handler=this._collapseend}else{handler=this._collapseendnoevents}this._rowCollapsed({owner:this,parentrow:tr});tr.next().find("> td > div").slideUp(this.options.animationDuration,function(ctx){handler.apply(this,[ctx,callback])})}else{this._rowCollapsed({owner:this,parentrow:tr});tr.next().find("> td > div").hide();tr.next().children().first().removeClass(this.css.childGridArea).addClass(this.css.childGridAreaCollapsed);tr.next().css("display","none").css("visibility","hidden");c.find(".ui-iggrid-expandbutton").removeClass(this.css.expandButtonExpanded).addClass(this.css.expandButton).attr("title",this.options.expandTooltip);if(!suppressEvents){this._trigger(this.events.rowCollapsed,null,{owner:this,parentrow:tr})}else if(callback){$.ig.util.invokeCallback(callback,[this,tr])}}tr.attr("state","c");tr.attr("aria-expanded",false)}},collapsed:function(element){var $e=element.length!==undefined?element:$(element);if($e===null||$e===undefined){return true}if($e.attr("state")==="c"||$e.attr("state")===undefined){return true}return false},populated:function(element){var $e=element.length!==undefined?element:$(element);if($e===null||$e===undefined){return false}if($e.attr("c")==="true"){return true}return false},_mouseOver:function(event){$(event.target).addClass(this.css.expandButtonHover)},_mouseOut:function(event){$(event.target).removeClass(this.css.expandButtonHover).addClass(this.css.expandButton)},_toggleInternalWithDelay:function(event){var self=this;setTimeout(function(){self._toggleInternal(event)},0);event.stopImmediatePropagation()},_toggleInternal:function(event,suppressEvents,callback){var created=$(event.target).closest("tr").attr("c"),tr=$(event.target).closest("tr"),p=tr.find(".ui-iggrid-expandcolumn"),hgrid=this,isExpand,expandTout=this.options.virtualization===true?50:0;isExpand=$(event.target).hasClass("ui-iggrid-expandbutton")||$(event.target).children(".ui-iggrid-expandbutton").length>0;if(!created&&this.options.initialDataBindDepth===-1&&isExpand){this.indicator.refreshPos();if(!$.ig.util.isWebKit){p.find(".ui-iggrid-expandbutton").css("visibility","hidden");this.indicator.show(false)}else{this.indicator.show(false)}setTimeout(function(){hgrid._toggleInternalAsync(event,suppressEvents,callback)},expandTout)}else{hgrid._toggleInternalAsync(event,suppressEvents,callback)}if(!suppressEvents){if(event.originalEvent&&typeof event.originalEvent.cancelBubble==="unknown"){event.originalEvent={}}event.stopImmediatePropagation()}},_toggleInternalAsync:function(event,suppressEvents,callback){var $td=$(event.target),parentrow=$td.closest("tr"),rowid="",keyspath="",keyspathvar="",pgridp,o,level=-1,sp=false,curpath=0,restSettingsSet,childds,created=parentrow.attr("c"),childrow,childgrids=[],ds,opts=[],id,k,isHierarchical,tmpkey,pki,dsobj,dsString,key,pgInstance,cs,popts,i,h,parentLevel=0,tmpgrid,state=parentrow.attr("state"),animatec,noCancel=true,noCancelChild=true,pid,instanceOfDs,eArgs;if($td.is("td")&&$td.attr("data-parent")!=="true"||$td.closest("td").attr("data-parent")!=="true"){return}if(state===undefined){state="c"}restSettingsSet=this.options.restSettings.update.url!==null||this.options.restSettings.update.template!==null||this.options.restSettings.create.url!==null||this.options.restSettings.create.template!==null||this.options.restSettings.remove.url!==null||this.options.restSettings.remove.template!==null;if(!created&&state==="c"){parentrow.after("<tr></tr>");childrow=parentrow.next();childrow.attr("data-container",true);popts=parentrow.closest("table").data("igGrid").options;opts=this._optsFor(popts);if(popts.childrenDataProperty===undefined){if(popts.key){keyspath=popts.key}}else{keyspath+=popts.childrenDataProperty}pgridp=parentrow.closest(".ui-iggrid-childarea").parent().prev();while(pgridp.length>0){if(curpath!==0){rowid+=this.options.pathSeparator}o=pgridp.closest(".ui-iggrid-table").data("igGrid").options;k=o.primaryKey;rowid+=k+":"+pgridp.attr("data-id");if(o.childrenDataProperty===undefined){if(o.key){keyspath+=this.options.pathSeparator+o.key}}else{keyspath+=this.options.pathSeparator+o.childrenDataProperty}pgridp=pgridp.closest(".ui-iggrid-childarea").parent().prev();curpath++}keyspath=keyspath.split(this.options.pathSeparator).reverse().join(this.options.pathSeparator);rowid=rowid.split(this.options.pathSeparator).reverse().join(this.options.pathSeparator);k=parentrow.closest("table").data("igGrid").options.primaryKey;if(rowid===""){rowid=k+":"+parentrow.attr("data-id")}else{rowid+=this.options.pathSeparator+k+":"+parentrow.attr("data-id")}cs=parentrow.find("td,th").length;animatec=$("<div></div>").appendTo($("<td></td>").appendTo(childrow).addClass(this.css.childGridArea).attr("colspan",cs));for(i=0;i<opts.length;i++){keyspathvar="";childgrids.push($("<table></table>").appendTo(animatec).attr("data-childgrid",true));if(i<opts.length-1){$("<div></div>").appendTo(animatec).addClass(this.css.childGridSeparator)}key=opts[i].key!==undefined?opts[i].key:opts[i].childrenDataProperty;childgrids[i].attr("id",this.root()[0].id+"_"+parentrow.attr("data-id")+"_"+key+"_child");parentLevel=parseInt(parentrow.closest("table").attr("data-level"),10);childgrids[i].attr("id",childgrids[i].attr("id").replace(",","-")).attr("data-level",parentLevel+1);if(keyspath===""){keyspathvar=opts[i].childrenDataProperty===undefined?opts[i].key:opts[i].childrenDataProperty}else{keyspathvar=this.options.pathSeparator+(opts[i].childrenDataProperty===undefined?opts[i].key:opts[i].childrenDataProperty)}childds=this._hds.dataAt(rowid,keyspath+keyspathvar);if($.type(childds)!=="array"&&!opts[i].responseDataKey&&childds!==undefined){childds=[childds]}else if(childds===null||childds===undefined){childds=[]}isHierarchical=false;if(opts[i].columnLayouts&&opts[i].columnLayouts.length>0){isHierarchical=true}if(isHierarchical){this._regevents(childgrids[i],this)}level=rowid.split(this.options.pathSeparator).length;if(level>this.options.initialDataBindDepth&&this.options.initialDataBindDepth!==-1){sp=true}ds=this._hdsoptions().dataSource;eArgs={owner:this,options:opts[i],element:childgrids[i],id:rowid,path:keyspath+keyspathvar};if(!sp){opts[i].dataSource=childds;if($.type(ds)==="string"&&this.options.rest!==true&&!opts[i].dataSourceUrl){opts[i].dataSourceUrl=ds}if(opts[i].dataSourceUrl&&$.type(opts[i].dataSourceUrl)==="string"){if(opts[i].dataSourceUrl.indexOf("?")!==-1){opts[i].dataSourceUrl+="&"+this._hds._encodeUrlPath(rowid,opts[i].key)}else{opts[i].dataSourceUrl+="?"+this._hds._encodeUrlPath(rowid,opts[i].key)}}if(this.options.autoGenerateLayouts===true){opts[i]._recurseSchema=true}childgrids[i].trigger(this.events.childGridCreating,eArgs);noCancelChild=childgrids[i].attr("data-create");if(noCancelChild!=="false"){if((this.options.rest||this.options.odata)&&restSettingsSet===true){this._inheritRestSettings(null,parentrow.attr("data-id"),keyspathvar.toLowerCase(),popts,opts[i])}if(isHierarchical){opts[i]._isHierarchicalGrid=true}pgInstance=parentrow.closest(".ui-iggrid-table").data("igGrid");if(pgInstance){opts[i].foreignKeyValue=pgInstance._fixPKValue(parentrow.data("id"))}else{opts[i].foreignKeyValue=parentrow.data("id")}h=$.proxy(this._childRendered,this);childgrids[i].bind("iggridrendered.hierarchicalgrid",h);childgrids[i].igGrid(opts[i]);if(isHierarchical){this._regToggleEvent(childgrids[i],this)}childgrids[i].trigger(this.events.childGridCreated,{owner:this,element:childgrids[i]})}if(opts[i].primaryKey===null||opts[i].primaryKey===undefined){if(opts[i].dataSource&&typeof opts[i].dataSource._xmlToArray==="function"&&typeof opts[i].dataSource._encodePkParams==="function"){throw new Error($.ig.Grid.locale.noPrimaryKey)}tmpgrid=childgrids[i].data("igGrid");tmpkey=tmpgrid.dataSource.schema().schema.searchField;if(tmpkey!==null){for(pki=0;pki<opts[i].dataSource[tmpkey].length;pki++){opts[i].dataSource[tmpkey][pki].ig_pk=tmpgrid.dataSource.data()[pki].ig_pk}}else{for(pki=0;pki<opts[i].dataSource.length;pki++){if(opts[i].dataSource[pki]){opts[i].dataSource[pki].ig_pk=tmpgrid.dataSource.data()[pki].ig_pk}}}}}else{instanceOfDs=ds&&typeof ds._xmlToArray==="function"&&typeof ds._encodePkParams==="function";if(this.options.odata){dsobj=instanceOfDs?ds.settings.dataSource:ds;dsString=popts.dataSource&&typeof popts.dataSource._xmlToArray==="function"&&typeof popts.dataSource._encodePkParams==="function"?popts.dataSource.settings.dataSource:popts.dataSource;childds=parentrow.closest("table").data("igGrid").dataSource.data();tmpkey=parentrow.attr("data-id");k=parentrow.closest("table").data("igGrid").options.primaryKey;if(parentrow.closest("table").data("igGrid").columnByKey(k).dataType==="number"){tmpkey=parseInt(tmpkey,10)}for(pki=0;pki<childds.length;pki++){if(childds[pki][parentrow.closest("table").data("igGrid").options.primaryKey]===tmpkey){childds=childds[pki][opts[i].key];break}}if(!childds){if(dsString.substr(dsString.length-1)==="/"){dsString=dsString.substring(0,dsString.length-1)}pid=typeof tmpkey==="string"?"'"+tmpkey+"'":tmpkey;if(keyspathvar.charAt(0)!=="/"){keyspathvar="/"+keyspathvar}if($.type(dsobj)==="string"&&dsobj!==dsString){dsString=dsobj.substring(0,dsobj.lastIndexOf("/"))+dsString.substring(dsString.lastIndexOf("/"))}opts[i].dataSource=dsString+"("+pid+")"+keyspathvar}else{if(childds.__deferred&&childds.__deferred.uri){opts[i].dataSource=childds.__deferred.uri;if(dsobj.indexOf("$callback=?")!==-1){opts[i].dataSource+="?$callback=?"}if(dsobj.indexOf("$format=")!==-1){if(dsobj.indexOf("$format=json")!==-1){opts[i].dataSource+="&$format=json"}else{opts[i].dataSource+="&$format=atom"}}}}if(restSettingsSet===true){this._inheritRestSettings(null,parentrow.attr("data-id"),keyspathvar.toLowerCase(),popts,opts[i])}}else if(this.options.rest===true){if(ds.substr(ds.length-1)!=="/"){ds+="/"}pid=parentrow.attr("data-id");opts[i].dataSource=ds+pid+"/"+keyspathvar.toLowerCase();if(restSettingsSet===true){this._inheritRestSettings(opts[i].dataSource,pid,keyspathvar.toLowerCase(),popts,opts[i])}}else if(instanceOfDs){opts[i].dataSource=ds.settings.dataSource+this._hds._encodeUrlPath(rowid,opts[i].key)}else{if(opts[i].dataSource){if(opts[i].dataSource.indexOf("?")!==-1){opts[i].dataSource+="&"+this._hds._encodeUrlPath(rowid,opts[i].key)}else{opts[i].dataSource+="?"+this._hds._encodeUrlPath(rowid,opts[i].key)}opts[i].dataSourceType="remoteUrl"}else{if($.type(opts[i].dataSource)==="string"&&$.type(ds)!=="string"){opts[i].dataSource+="?"+this._hds._encodeUrlPath(rowid,opts[i].key);opts[i].dataSourceType="remoteUrl"}else{opts[i].dataSource=ds+"?"+this._hds._encodeUrlPath(rowid,opts[i].key)}}if(opts[i].dataSource!==opts[i].dataSourceUrl){opts[i].dataSourceUrl=opts[i].dataSource}}}}if(sp){noCancel=this._trigger(this.events.childrenPopulating,null,{owner:this,parentrow:parentrow,id:rowid});if(noCancel){for(i=0;i<opts.length;i++){id=parentrow.attr("data-id");if(!this._eventQueue["id"+id]||!this._eventQueue["id"+id].length){this._eventQueue["id"+id]=[]}h=$.proxy(this._childRendered,this);this._eventQueue["id"+id].push({grid:childgrids[i],handler:h,parentrow:parentrow,id:rowid});childgrids[i].bind("iggridrendered",h);if(this.options.autoGenerateLayouts===true){opts[i]._recurseSchema=true}if(isHierarchical){opts[i]._isHierarchicalGrid=true}pgInstance=parentrow.closest(".ui-iggrid-table").data("igGrid");if(pgInstance){opts[i].foreignKeyValue=pgInstance._fixPKValue(parentrow.data("id"))}else{opts[i].foreignKeyValue=parentrow.data("id")}childgrids[i].trigger(this.events.childGridCreating,eArgs);noCancelChild=childgrids[i].attr("data-create");if(noCancelChild!=="false"){childgrids[i].igGrid(opts[i]);childgrids[i].trigger(this.events.childGridCreated,{owner:this,element:childgrids[i]});if(isHierarchical){this._regToggleEvent(childgrids[i],this)}}}}}animatec.attr("id","ac_"+parentrow.attr("data-id"));parentrow.attr("c",true);parentrow.next().hide();animatec.hide();this._expand(parentrow,suppressEvents,callback)}else{if(state==="e"){this._collapse(parentrow,suppressEvents,callback)}else if(state==="c"){this._expand(parentrow,suppressEvents,callback)}}this.indicator.hide();parentrow.find(".ui-iggrid-expandbutton").css("visibility","visible")},_layouts:function(){this.element.unbind("iggriddatarendering",this._databoundHandler)},_columnsGenerated:function(event,args){var layoutKey=args.key,layout;if(!layoutKey){return}layout=this._findLayout(this.rootWidget().options.columnLayouts,layoutKey);if(layout.columns&&layout.columns.length&&layout.columns.length>0){return}layout.columns=args.owner.options.columns},_findLayout:function(layouts,key){var i,layout;for(i=0;layouts&&i<layouts.length;i++){if(layouts[i].key===key){layout=layouts[i];break}if(!layout&&layouts[i].columnLayouts){layout=this._findLayout(layouts[i].columnLayouts,key)}}return layout},_hdsoptions:function(){var opts,schema,instanceOfHds;opts={responseDataKey:this.options.responseDataKey,responseTotalRecCountKey:this.options.responseTotalRecCountKey,dataSource:this.options.dataSource,primaryKey:this.options.primaryKey,localSchemaTransform:this.options.localSchemaTransform,autoCommit:this.options.autoCommit,odata:this.options.odata,serializeTransactionLog:this.options.serializeTransactionLog,updateUrl:this.options.updateUrl,restSettings:this.options.restSettings,initialDataBindDepth:this.options.initialDataBindDepth};if(this.options.dataSourceType!==null){opts.type=this.options.dataSourceType}schema=this._hschema();instanceOfHds=this.options.dataSource&&typeof this.options.dataSource._encodeHierarchicalUrlParams==="function"&&this.options.dataSource.settings&&this.options.dataSource.settings.hasOwnProperty&&this.options.dataSource.settings.hasOwnProperty("initialDataBindDepth");if(instanceOfHds&&this.options.dataSource.settings.schema===null||!instanceOfHds){opts=$.extend(opts,{schema:schema})}return opts},_getDataColumns:function(cols){var i,j,res=[],colsLength=cols.length,dCols;for(i=0;i<colsLength;i++){if(cols[i].group!==undefined&&cols[i].group!==null){dCols=this._getDataColumns(this._getDataColumns(cols[i].group));for(j=0;j<dCols.length;j++){res.push(dCols[j])}}else{res.push(cols[i])}}return res},_hschema:function(){var schema,i,j,rec,prop,cols=this._getDataColumns(this.options.columns),encodedLayouts=[],k,c;if(cols.length>0&&!this.options.autoGenerateColumns){schema={};schema.fields=[];j=0;for(i=0;i<cols.length;i++){if(cols[i].unbound===true){continue}schema.fields[j]={};schema.fields[j].name=cols[i].key;schema.fields[j].type=cols[i].dataType;j++}schema.searchField=this.options.responseDataKey}else if(this.options.autoGenerateColumns){schema={};schema.fields=[];if(this.options.dataSource&&this.options.dataSource.length&&this.options.dataSource.length>0&&$.type(this.options.dataSource)==="array"){rec=this.options.dataSource[0];for(prop in rec){if(rec.hasOwnProperty(prop)){for(k=0;k<cols;k++){if(cols[k].key===prop){c=cols[k];break}}if(c===null||c===undefined){schema.fields.push({name:prop,type:$.ig.getColType(rec[prop])})}else{if(c.unbound===true){continue}schema.fields.push({name:prop,type:c.dataType})}}}}}if(this.options.columnLayouts&&this.options.columnLayouts.length>0){for(j=0;j<this.options.columnLayouts.length;j++){schema.fields.push({name:this.options.columnLayouts[j].childrenDataProperty===undefined?this.options.columnLayouts[j].key:this.options.columnLayouts[j].childrenDataProperty})}}this._parseLayouts(encodedLayouts,"",this.options);schema.layouts=encodedLayouts;return schema},_parseLayouts:function(layouts,cpath,options){var j,layout,p,cdp=null;if(options.columnLayouts&&options.columnLayouts.length!==undefined&&options.columnLayouts.length>0){for(j=0;j<options.columnLayouts.length;j++){layout=options.columnLayouts[j];cdp=layout.childrenDataProperty===undefined?layout.key:layout.childrenDataProperty;if(!cdp){cdp=this.options.defaultChildrenDataProperty}p=cpath+this.options.pathSeparator+cdp+":"+layout.primaryKey;layouts[p]=layout;this._parseLayouts(layouts,p,layout)}}},_batchExpand:function(){var crows=[],tmpanim,hgrid;hgrid=this.element.closest(".ui-iggrid-root").data("igHierarchicalGrid");if(!hgrid){hgrid=this.element.data("igHierarchicalGrid")}tmpanim=hgrid.options.expandCollapseAnimations;hgrid.options.expandCollapseAnimations=false;crows=this.element.find("tr[data-id]");hgrid._batchExpandLevel(crows);hgrid.options.expandCollapseAnimations=tmpanim},_batchExpandLevel:function(rows){var i;for(i=0;i<rows.length;i++){this.toggle(rows[i])}},_renderExtraHeaderCell:function(row,colgroup,prepend){if(prepend===true){$("<td></td>").prependTo(row).css("border-width",0).attr("data-skip",true)}else{$("<td></td>").appendTo(row).css("border-width",0).attr("data-skip",true)}},_renderExtraFooterCell:function(row,colgroup,prepend,cssClass){if(prepend===true){$("<td></td>").addClass(cssClass).prependTo(row).attr("data-skip",true)}else{$("<td></td>").addClass(cssClass).appendTo(row).attr("data-skip",true)}},_headerrenderedinternal:function(sender,args){if(args.owner.element[0].id!==sender.currentTarget.id&&args.owner.element[0].id!==sender.currentTarget.id+"_table"){return}var self=this,flatRenderColgroup=args.owner._renderColgroup,tmpid,$thDataSkip;args.owner._renderRecord=$.proxy(this._hierarchicalRenderRecord,args.owner);args.owner._getFirstVisibleTR=$.proxy(this._hierarchicalGetFirstVisibleTR,args.owner);args.owner._getLastVisibleTR=$.proxy(this._hierarchicalGetLastVisibleTR,args.owner);args.owner._renderRecordInArray=$.proxy(this._hierarchicalRenderRecordInArray,args.owner);args.owner._renderColgroup=function(){self._hierarchicalRenderColgroup.apply(args.owner,$.merge([flatRenderColgroup,self],arguments))};args.owner._headerInitCallbacks.push({type:"HierarchicalGrid",func:$.proxy(this._renderExtraHeaderCell,this)});args.owner._footerInitCallbacks.push({type:"HierarchicalGrid",func:$.proxy(this._renderExtraFooterCell,this)});args.owner._trigger("headerextracellsmodified",null,{owner:args.owner});if(args.table.attr("id")!==args.owner.element.attr("id")&&$(args.table).find("colgroup col[data-expander]").length===0){$("<col></col>").attr("data-skip","true").attr("data-expander",true).prependTo(args.table.find("colgroup")).width(this.options.expandColWidth)}$thDataSkip=$("<th></th>");$("<span></span>").appendTo($thDataSkip.prependTo(args.table.find("thead tr:first")).addClass(this.css.expandHeaderCell).attr("data-skip",true)).addClass(this.css.expandHeaderCellTriangle);if(args.owner._isMultiColumnGrid){$thDataSkip.attr("rowspan",args.owner._maxLevel+1)}if(args.owner._isWrapped){tmpid=args.owner.element.attr("id").substring(0,args.owner.element.attr("id").indexOf("_table"));args.owner.container().find("#"+tmpid).unbind("iggridheaderrenderedinternal",args.owner.element.data("hr"));args.owner.container().find("#"+tmpid).removeData("hr")}else{args.owner.element.unbind("iggridheaderrenderedinternal",args.owner.element.data("hr"));args.owner.element.removeData("hr")}},_checkIsMultiColumnHeader:function(lobj){var i,cols=lobj.columns,colsLength;if(cols){colsLength=cols.length;for(i=0;i<colsLength;i++){if(cols[i].group!==undefined&&cols[i].group!==null){return true}}}return false},_hierarchicalRenderRecord:function(data,rowIndex){var i,grid=this,lod,hg,childprop,dstr="",val,markup="",layouts,hasChildren,noVisibleColumns,layout,temp;if(rowIndex%2!==0&&this.options.alternateRowStyles){dstr+='<tr class="'+grid.css.recordAltClass+'"'}else{dstr+="<tr"}dstr+=' data-row-idx="'+rowIndex+'"';if(!this._hg){hg=this.element.closest(".ui-iggrid-root").data("igHierarchicalGrid");if(!hg){hg=this.element.hasClass(".ui-iggrid-root")?this.element:undefined}this._hg=hg}else{hg=this._hg}if(this.options.foreignKey){dstr+=" data-id-fk='"+this._kval_from_key(this.options.foreignKey,data)+"'"}else{if(this.options.primaryKey===null||this.options.primaryKey===undefined){this.options.primaryKey="ig_pk";val=hg._getVal(data);dstr+=" data-id-fk='"+val+"'"}else if(this.options.primaryKey==="ig_pk"){val=hg._getVal(data);dstr+=" data-id-fk='"+val+"'"}else{dstr+=" data-id-fk='"+this._kval_from_key(this.options.primaryKey,data)+"'"}}if(this.options.primaryKey===null||this.options.primaryKey===undefined){this.options.primaryKey="ig_pk";val=hg._getVal(data);dstr+=" data-id='"+val+"'"}else if(this.options.primaryKey==="ig_pk"){val=hg._getVal(data);
dstr+=" data-id='"+val+"'"}else{dstr+=" data-id='"+this._kval_from_key(this.options.primaryKey,data)+"'"}dstr+=' role="row" aria-expanded="false" tabindex="'+this.options.tabIndex+'">';layouts=this.options.columnLayouts;hasChildren=false;lod=hg?hg.options.initialDataBindDepth>-1:false;if(!lod){for(i=0;layouts&&i<layouts.length;i++){if(data[layouts[i].key]){childprop=layouts[i].key;layout=layouts[i]}else{childprop=layouts[i].childrenDataProperty}childprop=childprop||this.options.defaultChildrenDataProperty;if(childprop){if(layout&&layout.responseDataKey){if(data[childprop]&&data[childprop][layout.responseDataKey]&&data[childprop][layout.responseDataKey].length!==undefined&&(data[childprop][layout.responseDataKey].length>0||this._shouldAlwaysRenderChildIndicator)){hasChildren=true;break}}else{if(data[childprop]){if(data[childprop].length!==undefined&&(data[childprop].length>0||this._shouldAlwaysRenderChildIndicator)){hasChildren=true;break}if(this.options.responseDataKey&&data[childprop][this.options.responseDataKey]&&data[childprop][this.options.responseDataKey].length!==undefined&&(data[childprop][this.options.responseDataKey].length>0||this._shouldAlwaysRenderChildIndicator)){hasChildren=true;break}}}}}}else{hasChildren=true}if(hasChildren){markup='<span class="ui-iggrid-expandbuttoncontainer"><span class="ui-iggrid-expandbutton ui-icon ui-icon-plus" title="'+hg.options.expandTooltip+'"></span></span>'}dstr+='<td tabindex="0" class="ui-iggrid-expandcolumn'+grid._addCellStyle(data,-1).replace(/class=\"/,"").replace(/\"/,"")+'" data-parent="'+hasChildren+'">'+markup+"</td>";noVisibleColumns=true;$(this.options.columns).each(function(colIndex){var col=grid.options.columns[colIndex];if(col.hidden){return}noVisibleColumns=false;dstr+='<td role="gridcell"  aria-readonly='+!!this.readOnly+' aria-describedby="'+grid.id()+"_"+this.key+'" tabindex="'+grid.options.tabIndex+'"';if(data[this.key]===undefined){if(this.template&&this.template.length){if(col.unbound){temp=grid._renderTemplatedCell(data,this)}else{temp=grid._renderTemplatedCell(data[colIndex],this)}if(temp.indexOf("<td")===0){dstr+=temp.substring(3)}else{dstr+=">"+temp}dstr=grid._editCellStyle(dstr,data,colIndex)}else{dstr+=grid._addCellStyle(data,colIndex,col)+">"+grid._renderCell(data[colIndex],this,data)}dstr+="</td>"}else{if(this.template&&this.template.length){temp=grid._renderTemplatedCell(data,this);if(temp.indexOf("<td")===0){dstr+=temp.substring(3)}else{dstr+=">"+temp}dstr=grid._editCellStyle(dstr,data,this.key)}else{dstr+=grid._addCellStyle(data,this.key,col)+">"+grid._renderCell(data[this.key],this,data)}dstr+="</td>"}});if(noVisibleColumns){dstr+='<td role="gridcell"></td>'}dstr+="</tr>";return dstr},_getVal:function(data){var val;if(data.ig_pk){val=data.ig_pk}else{val=$.ig.util.getCheckSumForObject(data);data.ig_pk=val}return val},_hierarchicalRenderRecordInArray:function(darr,tbody,data,rowIndex){var i,grid=this,lod,hg,childprop,layout,val,responseDataKey,markup="",layouts,hasChildren,noVisibleColumns,appendBehavior=false,temp;if(darr===null){darr=[];appendBehavior=true}if(rowIndex%2!==0&&this.options.alternateRowStyles){darr.push('<tr class="'+grid.css.recordAltClass+'"')}else{darr.push("<tr")}if(this.options.foreignKey){darr.push(" data-id-fk='"+this._kval_from_key(this.options.foreignKey,data)+"'")}else{if(this.options.primaryKey===null||this.options.primaryKey===undefined){this.options.primaryKey="ig_pk";val=$.ig.util.getCheckSumForObject(data);darr.push(" data-id-fk='"+val+"'");data.ig_pk=val}else if(this.options.primaryKey==="ig_pk"){val=$.ig.util.getCheckSumForObject(data);darr.push(" data-id-fk='"+val+"'");data.ig_pk=val}else{darr.push(" data-id-fk='"+this._kval_from_key(this.options.primaryKey,data)+"'")}}if(this.options.primaryKey===null||this.options.primaryKey===undefined){this.options.primaryKey="ig_pk";val=$.ig.util.getCheckSumForObject(data);darr.push(" data-id='"+val+"'");data.ig_pk=val}else if(this.options.primaryKey==="ig_pk"){val=$.ig.util.getCheckSumForObject(data);darr.push(" data-id='"+val+"'");data.ig_pk=val}else{darr.push(" data-id='"+this._kval_from_key(this.options.primaryKey,data)+"'")}darr.push(' role="row">');layouts=this.options.columnLayouts;hasChildren=false;hg=this.element.closest(".ui-iggrid-root").data("igHierarchicalGrid");if(!hg){hg=this.element.hasClass(".ui-iggrid-root")?this.element:undefined}lod=hg?hg.options.initialDataBindDepth>-1:false;if(!lod){for(i=0;layouts&&i<layouts.length;i++){layout=layouts[i];if(data[layout.key]){childprop=layout.key}else{childprop=layout.childrenDataProperty}childprop=childprop||this.options.defaultChildrenDataProperty;responseDataKey=layout&&layout.responseDataKey||this.options.responseDataKey;if(childprop&&data[childprop]){if(responseDataKey&&data[childprop][responseDataKey]&&data[childprop][responseDataKey].length!==undefined&&data[childprop][responseDataKey].length>0){hasChildren=true;break}if(data[childprop].length!==undefined&&data[childprop].length>0){hasChildren=true;break}}}}else{hasChildren=true}if(hasChildren){markup='<span class="ui-iggrid-expandbuttoncontainer"><span class="ui-iggrid-expandbutton ui-icon ui-icon-plus" title="'+hg.options.expandTooltip+'"></span></span>'}darr.push('<td tabindex="0" class="ui-iggrid-expandcolumn'+grid._addCellStyle(data,-1)+'" data-parent="'+hasChildren+'">'+markup+"</td>");noVisibleColumns=true;$(this.options.columns).each(function(colIndex){if(grid.options.columns[colIndex].hidden){return}noVisibleColumns=false;darr.push('<td role="gridcell"  aria-readonly='+!!this.readOnly+' aria-describedby="'+grid.id()+"_"+this.key+'" tabindex="'+grid.options.tabIndex+'"');if(data[this.key]===undefined){if(this.template&&this.template.length){temp=grid._renderTemplatedCell(data,this);if(temp.indexOf("<td")===0){darr[darr.length-1]=temp.replace("<td",darr[darr.length-1])}else{darr.push(">"+temp)}darr[darr.length-1]=grid._editCellStyle(darr[darr.length-1],data,colIndex)}else{darr.push(grid._addCellStyle(data,colIndex,grid.options.columns[colIndex])+">"+grid._renderCell(data[colIndex],this,data))}darr.push("</td>")}else{if(this.template&&this.template.length){temp=grid._renderTemplatedCell(data,this);if(temp.indexOf("<td")===0){darr[darr.length-1]=temp.replace("<td",darr[darr.length-1])}else{darr.push(">"+temp)}darr[darr.length-1]=grid._editCellStyle(darr[darr.length-1],data,this.key)}else{darr.push(grid._addCellStyle(data,this.key,grid.options.columns[colIndex])+">"+grid._renderCell(data[this.key],this,data))}darr.push("</td>")}});if(noVisibleColumns){darr.push('<td role="gridcell"></td>')}darr.push("</tr>");if(appendBehavior){tbody.append(darr.join(""))}},_hierarchicalRenderColgroup:function(flatRenderColgroup,hierarchicalGrid,table,isHeader,isFooter,autofitLastColumn){flatRenderColgroup.apply(this,[table,isHeader,isFooter,autofitLastColumn]);if($(table).find("colgroup col[data-expander]").length>0){return}$("<col></col>").prependTo($(table).find("colgroup")).css("width",hierarchicalGrid.options.expandColWidth).attr("data-skip","true").attr("data-expander",true)},_schemaGenerated:function(event,args){var hg,i,rec,schema=args.schema,ds=args.dataSource,$this=args.owner,prop;hg=$this.element.closest(".ui-iggrid-root").data("igHierarchicalGrid");if(!hg){hg=$this.element.hasClass(".ui-iggrid-root")?$this.element:undefined}if(!hg||hg.options.initialDataBindDepth>-1){return}for(i=0;ds&&ds.length&&$.type(ds)==="array"&&i<ds.length;i++){rec=ds[i];for(prop in rec){if(rec.hasOwnProperty(prop)){if(!$this._fieldExists(prop,schema)&&($.type(rec[prop])==="array"||$.type(rec[prop])==="object")){schema.fields.push({name:prop,type:$.ig.getColType(rec[prop])})}}}}},_childRendered:function(sender,args){var ptr=args.owner.element.closest("tr").prev(),pid="id"+ptr.attr("data-id"),e=this._eventQueue[pid],i,fire=true;this._trigger(this.events.childGridRendered,null,{owner:this,parentrow:ptr,childgrid:args.owner});if(!e){args.owner.element.unbind("iggridrendered.hierarchicalgrid");return}for(i=0;e.length!==undefined&&i<e.length;i++){if(e[i].grid.attr("id")===args.owner.element.attr("id")){e[i].done=true;e[i].grid.unbind("iggridrendered",e[i].handler);break}}for(i=0;e.length!==undefined&&i<e.length;i++){if(!e[i].done){fire=false;break}}if(fire){this._trigger(this.events.childrenPopulated,null,{owner:this,parentrow:ptr,id:e[0].id});delete this._eventQueue[pid]}},_optsFor:function(popts){var i,j,o=[],layouts;if(popts.columnLayouts&&popts.columnLayouts.length>0&&$.type(popts.columnLayouts)==="array"){layouts=popts.columnLayouts;for(j=0;j<layouts.length;j++){this._inherit(popts,layouts[j]);o.push($.extend(true,{},$.ui.igGrid.prototype.options,layouts[j]))}}for(i=0;i<o.length;i++){if(!o[i].dataSource){o[i].dataSourceUrl=popts.dataSourceUrl}else{if(String(popts.initialDataBindDepth)==="-1"||popts.initialDataBindDepth===undefined){o[i].dataSourceUrl=o[i].dataSource}}}return o},_inherit:function(parent,child){var i,f,j,nowrite;if(parent.dataSourceType){child.dataSourceType=parent.dataSourceType}if(!parent.features||parent.features.length===undefined||parent.features.length===0){return}if(!child.features||child.features.length===undefined){child.features=[]}for(i=0;i<parent.features.length;i++){if(parent.features[i].inherit===true){f=null;for(j=0;j<child.features.length;j++){if(child.features[j].name===parent.features[i].name){f=child.features[j];break}}if(f===null||f===undefined){child.features.push($.extend(true,{},parent.features[i]));child.features[child.features.length-1].columnSettings=[]}else{nowrite=false;if(child.features[j].columnSettings&&child.features[j].columnSettings.length>0){nowrite=true}child.features[j]=$.extend(true,{},parent.features[i],f);if(!nowrite){child.features[j].columnSettings=[]}}}}},_regevents:function(e,context){var headerRenderedInternal,datarendered,schemaGenerated;headerRenderedInternal=$.proxy(context._headerrenderedinternal,context);datarendered=$.proxy(this._handleBatchExpandRender,context);schemaGenerated=$.proxy(this._schemaGenerated,context);e.bind("iggridheaderrenderedinternal",headerRenderedInternal);e.bind("iggriddatarendered",datarendered);e.bind("iggridschemagenerated",schemaGenerated);e.data("hr",headerRenderedInternal)},_regToggleEvent:function(e,context){var toggle;toggle=$.proxy(context._toggleInternalWithDelay,context);e.undelegate(".ui-iggrid-expandcolumn > .ui-iggrid-expandbuttoncontainer","mousedown");e.delegate(".ui-iggrid-expandcolumn > .ui-iggrid-expandbuttoncontainer","mousedown",toggle)},commit:function(){var elem=this.element;elem.find(".ui-iggrid-table").each(function(){$(this).igGrid("commit")});elem.igGrid("commit")},rollback:function(rebind){var elem=this.element;elem.find(".ui-iggrid-table").each(function(){$(this).igGrid("rollback",null,rebind)});elem.igGrid("rollback",null,rebind)},_addToLog:function(elem,taLog,child){var grid=elem.data("igGrid"),ds=grid?grid.dataSource:null,gridLog=ds?ds._accumulatedTransactionLog:null,i=gridLog?gridLog.length:0;if(!i){return}this._dsLog=this._dsLog||[];this._dsLog.push(ds);while(i-->0){taLog.push($.extend(true,child?{layoutKey:grid.options.key}:{},gridLog[i]))}},saveChanges:function(success,error){var self=this,opts,elem=self.element,url=self.options.updateUrl,taLog=[];if((this.options.rest||this.options.odata)&&this.options.restSettings){this._saveChangesForEachGrid();return}if(!url||!elem){return}delete self._dsLog;self._addToLog(elem,taLog);elem.find(".ui-iggrid-table").each(function(){self._addToLog($(this),taLog,true)});opts={type:"POST",url:url,data:{ig_transactions:JSON.stringify(taLog)},success:function(data,textStatus,jqXHR){var logs=self._dsLog,i=logs?logs.length:0;while(i-->0){logs[i]._saveChangesSuccess(data,textStatus,jqXHR)}if(success){success(data,textStatus,jqXHR)}},error:function(jqXHR,textStatus,errorThrown){var logs=self._dsLog,i=logs?logs.length:0;while(i-->0){logs[i]._saveChangesError(jqXHR,textStatus,errorThrown)}if(error){error(jqXHR,textStatus,errorThrown)}}};$.ajax(opts)},_saveChangesForEachGrid:function(success,error){this.rootWidget().saveChanges(success,error);$.each(this.allChildrenWidgets(),function(){this.saveChanges(success,error)})},_handleBatchExpandRender:function(sender,args){var level=0,grid=args.owner,keyspath,ds,hdsData,o,k,curpath,rowid,popts,pgridp,gridId=grid.element[0].id,tId=sender.currentTarget.id;if(gridId!==tId&&gridId!==tId+"_table"){return}level=parseInt(grid.element.attr("data-level"),10);if(isNaN(level)){level=0;grid.element.attr("data-level",level)}if(level>0&&this.options.initialDataBindDepth===-1&&this._hds.settings.type==="json"&&$.type(grid.options.dataSource)==="string"){keyspath="";curpath=0;rowid="";popts=grid.options;if(popts.childrenDataProperty===undefined){if(popts.key){keyspath=popts.key}}else{keyspath+=popts.childrenDataProperty}pgridp=grid.element;pgridp=pgridp.closest(".ui-iggrid-childarea").parent().prev();while(pgridp.length>0){if(curpath!==0){rowid+=this.options.pathSeparator}o=pgridp.closest(".ui-iggrid-table").data("igGrid").options;k=o.primaryKey;rowid+=k+":"+pgridp.attr("data-id");if(o.childrenDataProperty===undefined){if(o.key){keyspath+=this.options.pathSeparator+o.key}}else{keyspath+=this.options.pathSeparator+o.childrenDataProperty}pgridp=pgridp.closest(".ui-iggrid-childarea").parent().prev();curpath++}keyspath=keyspath.split(this.options.pathSeparator).reverse().join(this.options.pathSeparator);rowid=rowid.split(this.options.pathSeparator).reverse().join(this.options.pathSeparator);hdsData=this._hds.dataAt(rowid,keyspath);ds=grid.dataSource;if(hdsData[popts.responseDataKey]){hdsData[popts.responseDataKey]=ds._dataView;hdsData.Metadata=ds.metadata()}}if(level>this.options.initialExpandDepth){return}if((this.options.initialDataBindDepth===-1||this.options.initialDataBindDepth>=this.options.initialExpandDepth)&&this.options.initialExpandDepth!==-1){setTimeout($.proxy(this._batchExpand,args.owner),1)}},_inheritRestSettings:function(path,pid,layout,popts,copts){var crest=copts.restSettings,prest=popts.restSettings,rs,ptmpl,fullpath;if(!path){if(prest.update.template||prest.remove.template){path=prest.update.template||prest.remove.template;path=path.replace("${id}",pid)}else{path=prest.create.url||prest.update.url||prest.remove.url;if(path.substr(path.length-1)!=="/"){path+="/"}path+=pid}if(layout.substr(0,1)==="/"){layout=layout.substr(1)}if(path.substr(path.length-1)!=="/"){path+="/"}fullpath=path+layout}else{fullpath=path}rs={update:{url:fullpath},create:{url:fullpath},remove:{url:fullpath}};if(crest.create.template&&prest.create.template){ptmpl=prest.create.template.replace("${id}",pid);crest.create.template=ptmpl+"/"+crest.create.template}if(crest.remove.template&&prest.remove.template){ptmpl=prest.remove.template.replace("${id}",pid);crest.remove.template=ptmpl+"/"+crest.remove.template}if(crest.update.template&&prest.update.template){ptmpl=prest.update.template.replace("${id}",pid);crest.update.template=ptmpl+"/"+crest.update.template}crest=$.extend(true,crest,rs)},_rowExpanded:function(args){var rowExpansion,rowHeight,parentGrid,currentHeight,rootGrid;rowExpansion=args.parentrow.next();if(rowExpansion.length===0||!rowExpansion.is('tr[data-container="true"]')){return}rowHeight=rowExpansion.outerHeight();parentGrid=args.parentrow.closest(".ui-iggrid-table").data("igGrid");currentHeight=parentGrid._getScrollContainerHeight();parentGrid._setScrollContainerHeight(currentHeight+rowHeight);rootGrid=this.element.closest(".ui-iggrid-root").data("igGrid");if(rootGrid.options.rowVirtualization&&!parentGrid.options.height&&rootGrid.options.height){currentHeight=rootGrid._getScrollContainerHeight();rootGrid._setScrollContainerHeight(currentHeight+rowHeight)}},_rowCollapsed:function(args){var rowExpansion=args.parentrow.next(),rowHeight,parentGrid,currentHeight,rootGrid;if(rowExpansion.length===0||!rowExpansion.is('tr[data-container="true"]')){return}rowHeight=rowExpansion.outerHeight();parentGrid=args.parentrow.closest(".ui-iggrid-table").data("igGrid");currentHeight=parentGrid._getScrollContainerHeight();parentGrid._setScrollContainerHeight(currentHeight-rowHeight);rootGrid=this.element.closest(".ui-iggrid-root").data("igGrid");if(rootGrid.options.rowVirtualization&&!parentGrid.options.height&&rootGrid.options.height){currentHeight=rootGrid._getScrollContainerHeight();rootGrid._setScrollContainerHeight(currentHeight-rowHeight)}},_hierarchicalGetFirstVisibleTR:function(visibleArea){var tableId="#"+this.element[0].id,firstVisibleTR;firstVisibleTR=$(tableId+' > tbody > tr:not([data-container="true"])').filter(function(){return this.offsetTop+$(this).height()>visibleArea.top}).first();return firstVisibleTR},_hierarchicalGetLastVisibleTR:function(visibleArea){var tableId="#"+this.element[0].id,lastVisibleTR;lastVisibleTR=$(tableId+' > tbody > tr:not([data-container="true"])').filter(function(){return this.offsetTop<visibleArea.bottom}).last();return lastVisibleTR},destroy:function(){this.tmpDataSource=null;this._rootgrid=null;this.rootWidget().destroy();$.Widget.prototype.destroy.call(this)}});$.extend($.ui.igHierarchicalGrid,{version:"15.2.20152.1027"})})(jQuery);