/*!@license * Infragistics.Web.ClientUI Hierarchical Grid 19.1.20 * * Copyright (c) 2011-2019 Infragistics Inc. * * http://www.infragistics.com/ * * Depends on: * jquery-1.9.1.js * jquery.ui.core.js * jquery.ui.widget.js * infragistics.ui.widget.js * infragistics.dataSource.js * infragistics.ui.shared.js * infragistics.util.js * infragistics.ui.grid.framework.js */ (function(factory){if(typeof define==="function"&&define.amd){define(["./infragistics.ui.grid.featurechooser","./infragistics.ui.grid.filtering","./infragistics.ui.grid.groupby","./infragistics.ui.grid.hiding","./infragistics.ui.grid.cellmerging","./infragistics.ui.grid.paging","./infragistics.ui.grid.resizing","./infragistics.ui.grid.rowselectors","./infragistics.ui.grid.selection","./infragistics.ui.grid.sorting","./infragistics.ui.grid.summaries","./infragistics.ui.grid.multicolumnheaders","./infragistics.ui.grid.columnmoving","./infragistics.ui.grid.tooltips","./infragistics.ui.grid.updating","./infragistics.ui.grid.responsive"],factory)}else{return factory(jQuery)}})(function($){$.widget("ui.igHierarchicalGrid",$.ui.igWidget,{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:undefined,collapseTooltip:undefined,locale:{expandTooltip:undefined,collapseTooltip:undefined},columnLayouts:[{key:null,primaryKey:null,foreignKey:null}],width:null,height:null,autoAdjustHeight:true,avgRowHeight:25,avgColumnWidth:null,defaultColumnWidth:null,autoGenerateColumns:true,virtualization:false,virtualizationMode:"fixed",rowVirtualization:false,columnVirtualization:false,virtualizationMouseWheelStep:null,adjustVirtualHeights:false,templatingEngine:"infragistics",columns:[{headerText:null,key:null,formatter:null,format:null,dataType:"string",width:null,hidden:false,template:null,unbound:false,groupOptions:{expanded:true,allowGroupCollapsing:false,hidden:"never"},group:[],dateDisplayType:"local",rowspan:0,formula:null,unboundValues:null,headerCssClass:null,columnCssClass:null,mapper:null,rowIndex:null,columnIndex:null,navigationIndex:null,colSpan:1,rowSpan:1}],dataSource:null,dataSourceUrl:null,dataSourceType:null,responseDataKey:null,responseTotalRecCountKey:null,requestType:"GET",responseContentType:"application/json; charset=utf-8",showHeader:true,showFooter:true,fixedHeaders:true,fixedFooters:true,caption:null,features:[{name:null}],tabIndex:0,localSchemaTransform:true,primaryKey:null,serializeTransactionLog:true,autoCommit:false,aggregateTransactions:false,autoFormat:"date",renderCheckboxes:false,updateUrl:null,restSettings:{create:{url:null,template:null,batch:false},update:{url:null,template:null,batch:false},remove:{url:null,template:null,batch:false},encodeRemoveInRequestUri:true,contentSerializer:null,contentType:"application/json; charset=utf-8"},alternateRowStyles:true,autofitLastColumn:true,enableHoverStyles:true,enableUTCDates:false,mergeUnboundColumns:false,jsonpRequest:false,enableResizeContainerCheck:true,featureChooserIconDisplay:"desktopOnly",scrollSettings:{scrollTop:0,scrollLeft:0,wheelStep:50,smoothing:false,smoothingStep:1,smoothingDuration:1,inertiaStep:1,inertiaDuration:1}},events:{rowExpanding:"rowExpanding",rowExpanded:"rowExpanded",rowCollapsing:"rowCollapsing",rowCollapsed:"rowCollapsed",childrenPopulating:"childrenPopulating",childrenPopulated:"childrenPopulated",childGridRendered:"childGridRendered",childGridCreating:"igchildgridcreating",childGridCreated:"igchildgridcreated",cellClick:"cellClick",cellRightClick:"cellRightClick",dataBinding:"dataBinding",dataBound:"dataBound",rendering:"rendering",rendered:"rendered",dataRendering:"dataRendering",dataRendered:"dataRendered",headerRendering:"headerRendering",headerRendered:"headerRendered",captionRendering:"captionRendering",captionRendered:"captionRendered",footerRendering:"footerRendering",footerRendered:"footerRendered",headerCellRendered:"headerCellRendered",rowsRendering:"rowsRendering",rowsRendered:"rowsRendered",schemaGenerated:"schemaGenerated",columnsCollectionModified:"columnsCollectionModified",requestError:"requestError",created:"igcontrolcreated",destroyed:"igcontroldestroyed"},_changeLanguage:function(language){var rootWidget=this.rootWidget();if(rootWidget){rootWidget._setOption("language",language);this.allChildren().each(function(){$(this).igGrid("option","language",language)})}},changeLocale:function(){var self=this,rootWidget=this.rootWidget();if(rootWidget){rootWidget.container().find("[data-toggle-button]").each(function(){self._changeLocaleForElement($(this))})}},changeRegional:function(){var rootWidget=this.rootWidget(),regional=this.options.regional;if(rootWidget){rootWidget._setOption("regional",regional);this.allChildren().each(function(){$(this).igGrid("option","regional",regional)})}},_setOption:function(key,value){var rootWidget=this.rootWidget();switch(key){case"dataSource":this.options.dataSource=value;this.dataBind();break;case"initialDataBindDepth":case"initialExpandDepth":case"expandColWidth":throw new Error(this._getLocaleValue("optionChangeNotSupported").replace("{optionName}",key));case"odata":case"defaultChildrenDataProperty":case"autoGenerateLayouts":case"expandCollapseAnimations":case"animationDuration":this._superApply(arguments);break;case"regional":this._superApply(arguments);break;case"locale":rootWidget._setOption(key,value);this._superApply(arguments);break;case"language":if(this.options.language!==value){this._superApply(arguments);this._changeLanguage(value)}break;default:if(rootWidget){rootWidget._setOption(key,value)}break}},_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._firstBind=true;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}this._superApply(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.hierarchicalgrid",this._columnsGeneratedHandler)}this.element.bind("iggridcolumnsgenerated.hierarchicalgrid",this._columnsGeneratedHandler);if(this.options.autoGenerateLayouts===true){if(!this._databoundHandler){this._databoundHandler=$.proxy(this._layouts,this)}else{this.element.unbind("iggridcolumnsgenerated.hierarchicalgrid",this._databoundHandler)}this.element.bind("iggriddatarendering.hierarchicalgrid",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;this.element.igGrid(opts);if(this.options.dataSourceUrl!==null&&this._firstBind){this.options.dataSource=this.options.dataSourceUrl;this._firstBind=false}}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;i0){for(i=0;i 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._getLocaleValue("collapseTooltip"),"data-localeid":"collapseTooltip","data-localeattr":"title"})}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._getLocaleValue("collapseTooltip"),"data-localeid":"collapseTooltip","data-localeattr":"title"});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._getLocaleValue("expandTooltip"),"data-localeid":"expandTooltip","data-localeattr":"title"});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._getLocaleValue("expandTooltip"),"data-localeid":"expandTooltip","data-localeattr":"title"});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,level=-1,sp=false,restSettingsSet,childds,created=parentrow.attr("c"),childrow,childgrids=[],ds,opts=[],id,k,isHierarchical,tmpkey,pki,key,pgInstance,cs,popts,i,j,h,parentLevel=0,tmpgrid,state=parentrow.attr("state"),animatec,noCancel=true,noCancelChild=true,pid,instanceOfDs,eArgs,currPathVar,paths,ids,childGrid,createdChildGrids=[];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("");childrow=parentrow.next();childrow.attr("data-container",true);popts=parentrow.closest("table").data("igGrid").options;opts=this._optsFor(popts);pgridp=parentrow.closest(".ui-iggrid-table");keyspath+=pgridp.attr("data-path")||"";rowid+=pgridp.attr("data-ids")||"";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=$("
").appendTo($("").appendTo(childrow).addClass(this.css.childGridArea).attr("colspan",cs));for(i=0;i").appendTo(animatec).attr("data-childgrid",true));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(childds===null||childds===undefined){childds=[]}else if($.type(childds)!=="array"&&!opts[i].responseDataKey&&childds!==undefined){childds=[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(!this.options.odata){opts[i].dataSourceUrl=$.ig.util.appendToQueryString(opts[i].dataSourceUrl,this._hds._encodeUrlPath(rowid,opts[i].key))}else{opts[i].dataSourceUrl=this._getOdataChildUrl(parentrow,keyspathvar,opts[i])}}if(this.options.autoGenerateLayouts===true){opts[i]._recurseSchema=true}noCancelChild=$.event.trigger(this.events.childGridCreating,eArgs,childgrids[i][0]);noCancelChild=childgrids[i].attr("data-create")!=="false"&&noCancelChild!==false;if(noCancelChild){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}opts[i].layoutPath=keyspath+keyspathvar;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]);childgrids[i].attr("data-path",keyspath+keyspathvar);childgrids[i].attr("data-ids",rowid);if(opts[i].dataSourceUrl&&$.type(opts[i].dataSourceUrl)==="string"&&this.options.odata){childGrid=childgrids[i].data("igGrid");childGrid.options.responseDataKey=this.options.responseDataKey;childGrid.dataSource.schema().schema.searchField=this.options.responseDataKey}if(isHierarchical){this._regToggleEvent(childgrids[i],this)}childgrids[i].trigger(this.events.childGridCreated,{owner:this,element:childgrids[i]});createdChildGrids.push(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(this._getLocaleValue("noPrimaryKey"))}tmpgrid=childgrids[i].data("igGrid");tmpkey=tmpgrid.dataSource.schema().schema.searchField;if(tmpkey!==null){for(pki=0;pki").insertBefore(tmpgrid.container()).addClass(this.css.childGridSeparator)}}},_getOdataChildUrl:function(parentrow,keyspathvar,childGridOpts){var popts=parentrow.closest("table").data("igGrid").options,ds=this._hdsoptions().dataSource,instanceOfDs=ds&&typeof ds._xmlToArray==="function"&&typeof ds._encodePkParams==="function",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=popts.primaryKey,dsURL,pki,pid,currPathVar;if(parentrow.closest("table").data("igGrid").columnByKey(k).dataType==="number"){tmpkey=parseInt(tmpkey,10)}pid=typeof tmpkey==="string"?"'"+tmpkey+"'":tmpkey;for(pki=0;pki0){return}layout.columns=args.owner.options.columns},_findLayout:function(layouts,key){var i,layout;for(i=0;layouts&&i0&&!this.options.autoGenerateColumns){schema={};schema.fields=[];j=0;for(i=0;i0&&$.type(this.options.dataSource)==="array"){rec=this.options.dataSource[0];for(prop in rec){if(rec.hasOwnProperty(prop)){for(k=0;k0){for(j=0;j0){for(j=0;j").prependTo(row).css("border-width",0).attr("data-skip",true)}else{$("").appendTo(row).css("border-width",0).attr("data-skip",true)}},_renderExtraFooterCell:function(row,colgroup,prepend,cssClass){if(prepend===true){$("").addClass(cssClass).prependTo(row).attr("data-skip",true)}else{$("").addClass(cssClass).appendTo(row).attr("data-skip",true)}},_dataBound:function(sender,args){var senderId=sender.currentTarget.id,ownerId=args.owner.element[0].id,o=args.owner.options;if(ownerId!==senderId&&ownerId!==senderId+"_table"){return}if(o.primaryKey===null||o.primaryKey===undefined){this._generatePrimaryKeyValues(args.dataSource.data());o.primaryKey="ig_pk"}},_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._cleanupTBody=function(){var $tbody=this.element.children("tbody");this._fireInternalEvent("_cleanupTBody");$tbody.children("tr").remove();return $tbody};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._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){$("").attr("data-skip","true").attr("data-expander",true).prependTo(args.table.find("colgroup")).width(this.options.expandColWidth)}$thDataSkip=$("");$("").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";layouts=this.options.columnLayouts;hasChildren=false;lod=hg?hg.options.initialDataBindDepth>-1:false;if(!lod){for(i=0;layouts&&i0||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=""+""}dstr+=""+markup+"";noVisibleColumns=true;$(this.options.columns).each(function(colIndex){var col=grid.options.columns[colIndex];cellClass=false;if(col.hidden){return}noVisibleColumns=false;dstr+=""+temp;cellClass=true}dstr=grid._editCellStyle(dstr,data,colIndex,col,cellClass)}else{dstr+=grid._addCellStyle(data,colIndex,col)+">"+grid._renderCell(data[colIndex],this,data)}dstr+=""}else{if(this.template&&this.template.length){temp=grid._renderTemplatedCell(data,this);if(temp.indexOf(""+temp;cellClass=true}dstr=grid._editCellStyle(dstr,data,this.key,col,cellClass)}else{dstr+=grid._addCellStyle(data,this.key,col)+">"+grid._renderCell(data[this.key],this,data)}dstr+=""}});if(noVisibleColumns){dstr+=""}dstr+="";return dstr},_generatePrimaryKeyValues:function(ds){ds=ds||[];var i,len=ds.length;for(i=0;icolgroup");if($colgroup.find(">col[data-expander]").length>0){return}$("").prependTo($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"&&i0&&$.type(popts.columnLayouts)==="array"){layouts=popts.columnLayouts;for(j=0;j0){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,columnStateChanged;headerRenderedInternal=$.proxy(context._headerrenderedinternal,context);datarendered=$.proxy(this._handleBatchExpandRender,context);schemaGenerated=$.proxy(this._schemaGenerated,context);columnStateChanged=$.proxy(this._columnStateChanged,context);e.bind("iggridheaderrenderedinternal.hierarchicalgrid",headerRenderedInternal);e.bind("iggriddatarendered.hierarchicalgrid",datarendered);e.bind("iggridschemagenerated.hierarchicalgrid",schemaGenerated);e.bind("iggriddatabound.hierarchicalgrid",$.proxy(this._dataBound,this));e.bind("iggridcolumnscollectionmodified.hierarchicalgrid",columnStateChanged);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.allTransactions():[],i;if(!gridLog.length){return}this._dsLog=this._dsLog||[];this._dsLog.push(ds);for(i=0;i0){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,rowid,popts,pgridp,parentRow,k,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="";rowid="";popts=grid.options;parentRow=grid.element.closest("tr[data-container]").prev("tr");pgridp=parentRow.closest(".ui-iggrid-table");keyspath+=pgridp.attr("data-path")||"";rowid+=pgridp.attr("data-ids")||"";k=pgridp.data("igGrid").options.primaryKey;if(rowid===""){rowid=k+":"+parentRow.attr("data-id")}else{rowid+=this.options.pathSeparator+k+":"+parentRow.attr("data-id")}if(popts.childrenDataProperty===undefined){if(popts.key){keyspath+=popts.key}}else{keyspath+=popts.childrenDataProperty}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)}},_columnStateChanged:function(sender,args){if(args.owner._initialized){this._handleBatchExpandRender(sender,args)}},_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