/*
jQWidgets v3.7.1 (2015-Feb)
Copyright (c) 2011-2015 jQWidgets.
License: http://jqwidgets.com/license/
*/
(function(n){n.extend(n.jqx._jqxGrid.prototype,{_calculateaggregate:function(t,i,r,u){var f=t.aggregates,e,o,u,s;if(f||(f=i),f){for(e=[],o=0;o<f.length;o++)f[o]!="count"&&(e[e.length]=t.cellsformat);if(this.source&&this.source.getAggregatedData)return u==undefined&&(u=this.getrows()),this.virtualmode&&(u=[],n.each(this.source._source.records,function(){u.push(this)})),r==undefined||r==!0?this.source.getAggregatedData([{name:t.datafield,aggregates:f,formatStrings:e}],this.gridlocalization,u):this.source.getAggregatedData([{name:t.datafield,aggregates:f}],this.gridlocalization,u)}return null},getcolumnaggregateddata:function(n,t,i,r){var u=this.getcolumn(n),s=i==undefined||i==!1?!1:i,o,f,e;return t==null?"":(o=u.aggregates,u.aggregates=null,f=this._calculateaggregate(u,t,s,r),e={},f&&(e=f[n]),u.aggregates=o,e)},refreshaggregates:function(){this._updatecolumnsaggregates()},renderaggregates:function(){this._updateaggregates()},_updatecolumnaggregates:function(t,i,r){var e=this,u,f;if(!i){r.children().remove();r.html("");t.aggregatesrenderer&&(u={},t.aggregates&&(u=this.getcolumnaggregateddata(t.datafield,t.aggregates)),f=t.aggregatesrenderer({},t,r,null),r.html(f));return}r.children().remove();r.html("");t.aggregatesrenderer?i&&(f=t.aggregatesrenderer(i[t.datafield],t,r,this.getcolumnaggregateddata(t.datafield,i[t.datafield])),r.html(f)):n.each(i,function(){var f=this,t,i;for(u in f)t=n('<div style="position: relative; margin: 4px; overflow: hidden;"><\/div>'),i=u,i=e._getaggregatename(i),t.html(i+":"+f[u]),e.rtl&&t.addClass(e.toThemeProperty("jqx-rtl")),r.append(t)})},_getaggregatetype:function(n){var t,i;switch(n){case"min":case"max":case"count":case"avg":case"product":case"var":case"varp":case"stdev":case"stdevp":case"sum":return n}t=n;for(i in n){t=i;break}return t},_getaggregatename:function(n){var t=n,i;switch(n){case"min":t="Min";break;case"max":t="Max";break;case"count":t="Count";break;case"avg":t="Avg";break;case"product":t="Product";break;case"var":t="Var";break;case"stdevp":t="StDevP";break;case"stdev":t="StDev";break;case"varp":t="VarP";case"sum":t="Sum"}if(n===t&&typeof t!="string")for(i in n){t=i;break}return t},_updatecolumnsaggregates:function(){var r=this.getrows(),u=this.columns.records.length,t;if(undefined!=this.statusbar[0].cells)for(t=0;t<u;t++){var f=n(this.statusbar[0].cells[t]),i=this.columns.records[t],e=this._calculateaggregate(i,null,!0,r);this._updatecolumnaggregates(i,e,f)}},_updateaggregates:function(){var u=n('<div style="position: relative;" id="statusrow'+this.element.id+'"><\/div>'),f=0,l=this.columns.records.length,e=this.toThemeProperty("jqx-grid-cell"),o,s,h,c,i;for(this.rtl&&(e+=" "+this.toThemeProperty("jqx-grid-cell-rtl"),f=-1),e+=" "+this.toThemeProperty("jqx-grid-cell-pinned"),o=l+10,s=[],this.statusbar[0].cells=s,h=0;h<l;h++){var t=this.columns.records[h],a=this._calculateaggregate(t),r=t.width;r<t.minwidth&&(r=t.minwidth);r>t.maxwidth&&(r=t.maxwidth);c=e;t.cellsalign&&(c+=" "+this.toThemeProperty("jqx-"+t.cellsalign+"-align"));i=n('<div style="overflow: hidden; position: absolute; height: 100%;" class="'+c+'"><\/div>');u.append(i);i.css("left",f);this.rtl?i.css("z-index",o++):i.css("z-index",o--);i.width(r);i[0].left=f;t.hidden&&t.hideable?i.css("display","none"):f+=r;s[s.length]=i[0];this._updatecolumnaggregates(t,a,i)}n.jqx.browser.msie&&n.jqx.browser.version<8&&u.css("z-index",o--);u.width(parseFloat(f)+2);u.height(this.statusbarheight);this.statusbar.children().remove();this.statusbar.append(u);this.statusbar.removeClass(this.toThemeProperty("jqx-widget-header"));this.statusbar.addClass(e);this.statusbar.css("border-bottom-color","transparent");this.statusbar.css("border-top-width","1px");this.rtl&&this.hScrollBar.css("visibility")!="hidden"&&this._renderhorizontalscroll()}})})(jqxBaseFramework)