';
if (r) {
var s = '
';
k--;
}
var f = 0;
for (var x = 0; x < A; x++) {
var w = C.columns.records[x];
var t = w.width;
if (t < w.minwidth) {t = w.minwidth;}
if (t > w.maxwidth) {t = w.maxwidth;}
if (C.rtl) {
var q = k - A + 2 * x;
var d = '
';
var y = this._defaultcellsrenderer("", w);
d += y;
d += "
";
s += d;
}
if (p == 0) {
C.table.width(parseInt(f) + 2);
p = f;
}
s += "
";
v += s;
}
if (C.WinJS) {MSApp.execUnsafeLocalFunction(function () {C.table.html(v);});} else {C.table[0].innerHTML = v;}
C.table[0].rows = new Array();
var m = C.table.children();
for (var z = 0; z < u; z++) {
var h = m[z];
C.table[0].rows.push(h);
h.cells = new Array();
var e = b(h).children();
for (var x = 0; x < A; x++) {h.cells.push(e[x]);}
}
if (u == 0) {
var f = 0;
if (C.showemptyrow) {
var s = b('
');
C.table.append(s);
s.height(C.rowsheight);
C.table[0].rows[0] = s[0];
C.table[0].rows[0].cells = new Array();
}
for (var x = 0; x < A; x++) {
var w = C.columns.records[x];
var t = w.width;
if (C.showemptyrow) {
var d = b('
');
d.height(C.rowsheight);
s.append(d);
C.table[0].rows[0].cells[x] = d[0];
}
if (t < w.minwidth) {t = w.minwidth;}
if (t > w.maxwidth) {t = w.maxwidth;}
if (!(w.hidden && w.hideable) && !w.adaptivehidden) {f += t;}
}
C.table.width(parseInt(f) + 2);
p = f;
}
C._updatescrollbarsafterrowsprerender();
if (C.rendered) {C.rendered("rows");}
C.toCompile = new Array();
C._addoverlayelement();
}
},
_groupsheader: function () {return this.groupable && this.showgroupsheader;},
_arrange: function () {
var A = null;
var x = null;
this.tableheight = null;
var F = this.that;
var n = false;
var m = false;
if (F.width != null && F.width.toString().indexOf("px") != -1) {A = F.width;} else {if (F.width != undefined && !isNaN(F.width)) {A = F.width;}}
if (F.width != null && F.width.toString().indexOf("%") != -1) {
A = F.width;
n = true;
}
if (F.scrollbarautoshow) {
F.vScrollBar[0].style.display = "none";
F.hScrollBar[0].style.display = "none";
F.vScrollBar[0].style.zIndex = F.tableZIndex + F.headerZIndex;
F.hScrollBar[0].style.zIndex = F.tableZIndex + F.headerZIndex;
}
if (F.autowidth) {
var p = 0;
for (var B = 0; B < F.columns.records.length; B++) {
var e = F.columns.records[B].width;
if (e == "auto") {
e = F._measureElementWidth(F.columns.records[B].text);
p += e;
} else {p += e;}
}
if (F.vScrollBar.css("visibility") != "hidden") {p += F.scrollbarsize + 4;}
A = p;
F.width = A;
}
if (F.height != null && F.height.toString().indexOf("px") != -1) {x = F.height;} else {if (F.height != undefined && !isNaN(F.height)) {x = F.height;}}
if (F.height != null && F.height.toString().indexOf("%") != -1) {
x = F.height;
m = true;
}
var k = function () {
var i = 0;
var w = F.showheader ? F.columnsheader != null ? F.columnsheader.height() + 2 : 0 : 0;
i += w;
if (F.pageable) {i += F.pagerheight;}
if (F._groupsheader()) {i += F.groupsheaderheight;}
if (F.showtoolbar) {i += F.toolbarheight;}
if (F.showstatusbar) {i += F.statusbarheight;}
if (F.showeverpresentrow && F.everpresentrowposition === "bottom") {i += F.everpresentrowheight;}
if (F.hScrollBar[0].style.visibility == "visible") {i += 15;}
return i;
};
if (F.autoheight && F.virtualsizeinfo) {
if (F.pageable && F.gotopage) {
var C = 0;
x = C + (F._pageviews[0] ? F._pageviews[0].height : 0);
x += k();
if (F.showemptyrow && F.dataview.totalrecords == 0) {x += F.rowsheight;}
} else {
var C = F.host.height() - F._gettableheight();
if (F._pageviews.length > 0) {
x = C + F._pageviews[F._pageviews.length - 1].height + F._pageviews[F._pageviews.length - 1].top;
F.vScrollBar[0].style.visibility = "hidden";
} else {
x = k();
if (F.showemptyrow) {x += F.rowsheight;}
}
}
} else {
if (F.autoheight) {
x = F.dataview.totalrecords * F.rowsheight;
if (F.pageable && F.gotopage) {x = F.pagesize * F.rowsheight;}
if (F._loading) {
x = 250;
F.dataloadelement.height(x);
}
x += k();
if (x > 10000) {x = 10000;}
}
}
if (A != null) {
A = parseInt(A);
if (!n) {if (F.element.style.width != parseInt(F.width) + "px") {F.element.style.width = parseInt(F.width) + "px";}} else {F.element.style.width = F.width;}
if (n) {
A = F.host.width();
if (A <= 2) {
A = 600;
F.host.width(A);
}
if (!F._oldWidth) {F._oldWidth = A;}
}
} else {F.host.width(250);}
if (x != null) {
if (!m) {x = parseInt(x);}
if (!m) {if (F.element.style.height != parseInt(x) + "px") {F.element.style.height = parseInt(x) + "px";}} else {F.element.style.height = F.height;}
if (m && !F.autoheight) {
x = F.host.height();
if (x == 0) {
x = 400;
F.host.height(x);
}
if (!F._oldHeight) {F._oldHeight = x;}
}
} else {F.host.height(250);}
if (F.autoheight) {
F.tableheight = null;
F._gettableheight();
}
var v = 0;
if (F.showtoolbar) {
F.toolbar.width(A);
F.toolbar.height(F.toolbarheight - 1);
F.toolbar.css("top", 0);
v += F.toolbarheight;
x -= parseInt(F.toolbarheight);
} else {F.toolbar[0].style.height = "0px";}
if (F.showstatusbar) {
if (F.showaggregates) {F.statusbar.width(!F.table ? A : Math.max(A, F.table.width()));} else {F.statusbar.width(A);}
F.statusbar.height(F.statusbarheight);
} else {F.statusbar[0].style.height = "0px";}
if (F.showeverpresentrow && F.everpresentrowposition === "bottom") {
F.addnewrow.width(A);
F.addnewrow.height(F.everpresentrowheight);
} else {F.addnewrow[0].style.height = "0px";}
if (F._groupsheader()) {
F.groupsheader.width(A);
F.groupsheader.height(F.groupsheaderheight);
F.groupsheader.css("top", v);
var y = F.groupsheader.height() + 1;
v += y;
if (x > y) {x -= parseInt(y);}
} else {
if (F.groupsheader[0].style.width != A + "px") {F.groupsheader[0].style.width = parseInt(A) + "px";}
F.groupsheader[0].style.height = "0px";
if (F.groupsheader[0].style.top != v + "px") {F.groupsheader.css("top", v);}
var y = F.showgroupsheader && F.groupable ? F.groupsheaderheight : 0;
var f = v + y + "px";
if (F.content[0].style.top != f) {F.content.css("top", v + F.groupsheaderheight);}
}
var d = F.scrollbarsize;
if (isNaN(d)) {
d = parseInt(d);
if (isNaN(d)) {d = "17px";} else {d = d + "px";}
}
d = parseInt(d);
var s = 4;
var h = 2;
var j = 0;
if (F.vScrollBar[0].style.visibility == "visible") {j = d + s;}
if (F.hScrollBar[0].style.visibility == "visible") {h = d + s + 2;}
if (d == 0) {
j = 0;
h = 0;
}
var r = 0;
if (F.pageable) {
r = F.pagerheight;
h += F.pagerheight;
}
if (F.showstatusbar) {
h += F.statusbarheight;
r += F.statusbarheight;
}
if (F.showeverpresentrow && F.everpresentrowposition === "bottom") {
h += F.everpresentrowheight;
r += F.everpresentrowheight;
}
if (F.hScrollBar[0].style.height != d + "px") {F.hScrollBar[0].style.height = parseInt(d) + "px";}
if (F.hScrollBar[0].style.top != v + x - s - d - r + "px" || F.hScrollBar[0].style.left != "0px") {F.hScrollBar.css({ top: v + x - s - d - r + "px", left: "0px" });}
var q = F.hScrollBar[0].style.width;
var l = false;
var D = false;
if (j == 0) {
if (q != (A - 2) + "px") {
F.hScrollBar.width(A - 2);
l = true;
}
} else {
if (q != (A - d - s) + "px") {
F.hScrollBar.width(A - d - s + "px");
l = true;
}
}
if (!F.autoheight) {
if (F.vScrollBar[0].style.width != d + "px") {
F.vScrollBar.width(d);
D = true;
}
if (F.vScrollBar[0].style.height != parseInt(x) - h + "px") {
F.vScrollBar.height(parseInt(x) - h + "px");
D = true;
}
if (F.vScrollBar[0].style.left != parseInt(A) - parseInt(d) - s + "px" || F.vScrollBar[0].style.top != v + "px") {F.vScrollBar.css({ left: parseInt(A) - parseInt(d) - s + "px", top: v });}
}
if (F.rtl) {
F.vScrollBar.css({ left: "0px", top: v });
if (F.vScrollBar.css("visibility") != "hidden") {F.hScrollBar.css({ left: d + 2 });}
}
var o = F.vScrollInstance;
o.disabled = F.disabled;
if (!F.autoheight) {if (D) {o.refresh();}}
var z = F.hScrollInstance;
z.disabled = F.disabled;
if (l) {z.refresh();}
if (F.autowidth) {F.hScrollBar[0].style.visibility = "hidden";}
F.statusbarheight = parseInt(F.statusbarheight);
F.toolbarheight = parseInt(F.toolbarheight);
var t = function (w) {
if ((w.vScrollBar[0].style.visibility == "visible") && (w.hScrollBar[0].style.visibility == "visible")) {
w.bottomRight[0].style.visibility = "visible";
w.bottomRight.css({ left: 1 + parseInt(w.vScrollBar.css("left")), top: parseInt(w.hScrollBar.css("top")) });
if (w.rtl) {w.bottomRight.css("left", "0px");}
w.bottomRight.width(parseInt(d) + 3);
w.bottomRight.height(parseInt(d) + 4);
var G = w.showeverpresentrow && w.everpresentrowposition == "bottom";
var i = G ? w.everpresentrowheight : 0;
if (i > 0 && !w.showaggregates) {
w.bottomRight.css("z-index", 99);
w.bottomRight.height(parseInt(d) + 4 + i);
w.bottomRight.css({ top: parseInt(w.hScrollBar.css("top")) - i });
}
if (w.showaggregates) {
w.bottomRight.css("z-index", 99);
w.bottomRight.height(parseInt(d) + 4 + w.statusbarheight + i);
w.bottomRight.css({ top: parseInt(w.hScrollBar.css("top")) - w.statusbarheight - i });
}
} else {w.bottomRight[0].style.visibility = "hidden";}
};
t(this);
if (F.content[0].style.width != A - j + "px") {F.content.width(A - j);}
if (F.content[0].style.height != x - h + 3 + "px") {F.content.height(x - h + 3);}
if (F.scrollbarautoshow) {
if (F.content[0].style.width != A + "px") {F.content.width(A);}
if (F.content[0].style.height != x + "px") {F.content.height(x);}
}
if (F.content[0].style.top != v + "px") {F.content.css("top", v);}
if (F.rtl) {
F.content.css("left", j);
if (F.scrollbarautoshow) {F.content.css("left", "0px");}
if (F.table) {
var u = F.table.width();
if (u < A - j) {F.content.css("left", A - u);}
}
}
if (F.showstatusbar) {
F.statusbar.css("top", v + x - F.statusbarheight - (F.pageable ? F.pagerheight : 0));
if (F.showaggregates) {
if (F.hScrollBar.css("visibility") == "visible") {
F.hScrollBar.css({ top: v + x - s - d - r + F.statusbarheight + "px" });
F.statusbar.css("top", 1 + v + x - d - 5 - F.statusbarheight - (F.pageable ? F.pagerheight : 0));
}
t(this);
}
if (F.rtl) {if (F.hScrollBar.css("visibility") != "visible") {F.statusbar.css("left", F.content.css("left"));} else {F.statusbar.css("left", "0px");}}
}
if (F.showeverpresentrow && F.everpresentrowposition === "bottom") {
F.addnewrow.css("top", v + x - (F.showstatusbar ? F.statusbarheight : 0) - (F.pageable ? F.pagerheight : 0) - F.everpresentrowheight);
if (F.rtl) {if (F.hScrollBar.css("visibility") != "visible") {F.addnewrow.css("left", F.content.css("left"));} else {F.addnewrow.css("left", "0px");}}
}
if (F.pageable) {
F.pager.width(A);
F.pager.height(F.pagerheight);
F.pager.css("top", v + x - F.pagerheight - 1);
} else {F.pager[0].style.height = "0px";}
if (F.table != null) {
var g = -2;
if (F.vScrollBar[0].style.visibility == "visible") {g = F.scrollbarsize + 3;}
if (F.hScrollBar[0].style.visibility == "visible") {
var E = g + F.table.width() - F.host.width();
if (E >= 0) {F.hScrollBar.jqxScrollBar("max", E);}
if (F.hScrollBar[0].style.visibility == "visible" && E == 0) {
F.hScrollBar[0].style.visibility = "hidden";
F._arrange();
}
}
}
if (A != parseInt(F.dataloadelement[0].style.width)) {F.dataloadelement[0].style.width = F.element.style.width;}
if (x != parseInt(F.dataloadelement[0].style.height)) {F.dataloadelement[0].style.height = F.element.style.height;}
if (this.pagergotoinput) {
if (this.pagergotoinput.offset().top !== this.pagergoto.offset().top) {
this.pagergotoinput.css("visibility", "hidden");
this.pagergoto.css("visibility", "hidden");
} else {
this.pagergotoinput.css("visibility", "inherit");
this.pagergoto.css("visibility", "inherit");
}
}
F._hostwidth = A;
},
destroy: function () {
delete b.jqx.dataFormat.datescache;
delete this.gridlocalization;
b.jqx.utilities.resize(this.host, null, true);
if (document.referrer != "" || window.frameElement) {if (window.top != null && window.top != window.self) {this.removeHandler(b(window.top.document), "mouseup.grid" + this.element.id);}}
if (this.table && this.table[0]) {
var m = this.table[0].rows.length;
for (var k = 0; k < m; k++) {
var q = this.table[0].rows[k];
var p = q.cells;
var f = p.length;
for (var h = 0; h < f; h++) {
b(q.cells[h]).remove();
q.cells[h] = null;
delete q.cells[h];
}
q.cells = null;
if (q.cells) {delete q.cells;}
b(this.table[0].rows[k]).remove();
this.table[0].rows[k] = null;
}
try {delete this.table[0].rows;} catch (n) {}
this.table.remove();
delete this.table;
}
if (this.columns && this.columns.records) {
for (var k = 0; k < this.columns.records.length; k++) {
var e = this.columns.records[k];
if (e.addnewrowwidget) {if (e.destroyeverpresentrowwidget) {e.destroyeverpresentrowwidget(e.addnewrowwidget);}}
if (e.destroywidget) {if (e.destroywidget) {e.destroywidget(e.widget);}}
this._removecolumnhandlers(this.columns.records[k]);
if (e.element) {
b(e.element).remove();
b(e.sortasc).remove();
b(e.sortdesc).remove();
b(e.filtericon).remove();
b(e.menu).remove();
e.element = null;
e.uielement = null;
e.sortasc = null;
e.sortdesc = null;
e.filtericon = null;
e.menu = null;
delete e.element;
delete e.uielement;
delete e.sortasc;
delete e.sortdesc;
delete e.filtericon;
delete e.menu;
delete this.columnsrow[0].cells[k];
}
}
try {delete this.columnsrow[0].cells;} catch (n) {}
delete this.columnsrow;
}
b.removeData(document.body, "contextmenu" + this.element.id);
if (this.host.jqxDropDownList) {if (this._destroyfilterpanel) {this._destroyfilterpanel();}}
if (this.editable && this._destroyeditors) {this._destroyeditors();}
if (this.filterable && this._destroyedfilters && this.showfilterrow) {this._destroyedfilters();}
if (this.host.jqxMenu) {
if (this.gridmenu) {
this.removeHandler(b(document), "click.menu" + this.element.id);
this.removeHandler(this.gridmenu, "keydown");
this.removeHandler(this.gridmenu, "closed");
this.removeHandler(this.gridmenu, "itemclick");
this.gridmenu.jqxMenu("destroy");
this.gridmenu = null;
}
}
if (this.pagershowrowscombo) {
this.pagershowrowscombo.jqxDropDownList("destroy");
this.pagershowrowscombo = null;
}
if (this.pagerrightbutton) {
this.removeHandler(this.pagerrightbutton, "mousedown");
this.removeHandler(this.pagerrightbutton, "mouseup");
this.removeHandler(this.pagerrightbutton, "click");
this.pagerrightbutton.jqxButton("destroy");
this.pagerrightbutton = null;
}
if (this.pagerleftbutton) {
this.removeHandler(this.pagerleftbutton, "mousedown");
this.removeHandler(this.pagerleftbutton, "mouseup");
this.removeHandler(this.pagerleftbutton, "click");
this.pagerleftbutton.jqxButton("destroy");
this.removeHandler(b(document), "mouseup.pagerbuttons" + this.element.id);
this.pagerleftbutton = null;
}
this.removeHandler(b(document), "selectstart." + this.element.id);
this.removeHandler(b(document), "mousedown.resize" + this.element.id);
this.removeHandler(b(document), "mouseup.resize" + this.element.id);
this.removeHandler(b(document), "mousemove.resize" + this.element.id);
if (this.isTouchDevice()) {
var l = b.jqx.mobile.getTouchEventName("touchmove") + ".resize" + this.element.id;
var d = b.jqx.mobile.getTouchEventName("touchstart") + ".resize" + this.element.id;
var g = b.jqx.mobile.getTouchEventName("touchend") + ".resize" + this.element.id;
this.removeHandler(b(document), l);
this.removeHandler(b(document), d);
this.removeHandler(b(document), g);
}
this.removeHandler(b(document), "mousedown.reorder" + this.element.id);
this.removeHandler(b(document), "mouseup.reorder" + this.element.id);
this.removeHandler(b(document), "mousemove.reorder" + this.element.id);
if (this.isTouchDevice()) {
var l = b.jqx.mobile.getTouchEventName("touchmove") + ".reorder" + this.element.id;
var d = b.jqx.mobile.getTouchEventName("touchstart") + ".reorder" + this.element.id;
var g = b.jqx.mobile.getTouchEventName("touchend") + ".reorder" + this.element.id;
this.removeHandler(b(document), l);
this.removeHandler(b(document), d);
this.removeHandler(b(document), g);
}
this.removeHandler(b(window), "resize." + this.element.id);
if (this.resizeline) {this.resizeline.remove();}
if (this.resizestartline) {this.resizestartline.remove();}
if (this.groupable) {
var l = "mousemove.grouping" + this.element.id;
var d = "mousedown.grouping" + this.element.id;
var g = "mouseup.grouping" + this.element.id;
this.removeHandler(b(document), l);
this.removeHandler(b(document), d);
this.removeHandler(b(document), g);
}
if (this.columnsreorder) {
var l = "mousemove.reorder" + this.element.id;
var d = "mousedown.reorder" + this.element.id;
var g = "mouseup.reorder" + this.element.id;
this.removeHandler(b(document), l);
this.removeHandler(b(document), d);
this.removeHandler(b(document), g);
delete this.columnsbounds;
}
if (this.content) {
this.removeHandler(this.content, "mousedown");
this.removeHandler(this.content, "scroll");
}
this._removeHandlers();
this.hScrollInstance.destroy();
this.vScrollInstance.destroy();
this.hScrollBar.remove();
this.vScrollBar.remove();
this._clearcaches();
delete this.hScrollInstance;
delete this.vScrollInstance;
delete this.visiblerows;
delete this.hittestinfo;
delete this.rows;
delete this.columns;
delete this.columnsbydatafield;
delete this.pagescache;
delete this.pageviews;
delete this.cellscache;
delete this.heights;
delete this.hiddens;
delete this.hiddenboundrows;
delete this.heightboundrows;
delete this.detailboundrows;
delete this.details;
delete this.expandedgroups;
delete this._rowdetailscache;
delete this._rowdetailselementscache;
delete this.columnsmenu;
if (this.columnsheader) {
this.columnsheader.remove();
delete this.columnsheader;
}
if (this.selectionarea) {
this.selectionarea.remove();
delete this.selectionarea;
}
if (this.menuitemsarray && this.menuitemsarray.length) {
var o = this.menuitemsarray.length;
for (var k = 0; k < o; k++) {b(this.menuitemsarray[k]).remove();}
}
delete this.menuitemsarray;
this.dataview._clearcaches();
this.content.removeClass();
this.content.remove();
this.content = null;
delete this.content;
this.vScrollBar = null;
this.hScrollBar = null;
delete this.hScrollBar;
delete this.hScrollBar;
if (this.gridcontent) {
this.gridcontent.remove();
delete this.gridcontent;
}
if (this.gridmenu) {
this.gridmenu = null;
delete this.gridmenu;
}
delete this._mousemovefunc;
delete this._mousewheelfunc;
this.dataview.destroy();
delete this.dataview;
this.bottomRight.remove();
delete this.bottomRight;
this.wrapper.remove();
delete this.wrapper;
if (this.pagerdiv) {
this.pagerdiv.remove();
delete this.pagerdiv;
}
if (this.pagerpageinput) {
this.pagerpageinput.remove();
delete this.pagerpageinput;
}
if (this.pagergoto) {
this.pagergoto.remove();
delete this.pagergoto;
}
if (this.pagershowrows) {
this.pagershowrows.remove();
delete this.pagershowrows;
}
if (this.pagerfirstbutton) {
this.pagerfirstbutton.remove();
delete this.pagerfirstbutton;
}
if (this.pagerlastbutton) {
this.pagerlastbutton.remove();
delete this.pagerlastbutton;
}
if (this.pagerbuttons) {
this.pagerbuttons.remove();
delete this.pagerbuttons;
}
if (this.pagerdetails) {
this.pagerdetails.remove();
delete this.pagerdetails;
}
if (this.pagergotoinput) {
this.pagergotoinput.remove();
delete this.pagergotoinput;
}
this.pager.remove();
delete this.pager;
this.groupsheader.remove();
delete this.groupsheader;
this.dataloadelement.remove();
delete this.dataloadelement;
this.toolbar.remove();
delete this.toolbar;
this.statusbar.remove();
delete this.statusbar;
this.host.removeData();
this.host.removeClass();
this.host.remove();
this.host = null;
delete this.host;
delete this.element;
delete this.set;
delete this.get;
delete this.that;
delete this.call;
},
_initializeColumns: function () {
var f = this.source ? this.source.datafields : null;
if (f == null && this.source && this.source._source) {f = this.source._source.datafields;}
var k = f ? f.length > 0 : false;
if (this.autogeneratecolumns) {
var m = new Array();
if (f) {
b.each(f, function () {
var i = { datafield: this.name, text: this.text || this.name, cellsformat: this.format || "" };
m.push(i);
});
} else {
if (this.source.records.length > 0) {
var o = this.source.records[0];
for (var h in o) {
if (h != "uid") {
var g = { width: 100, datafield: h, text: h };
m.push(g);
}
}
}
}
this.columns = m;
}
if (this.columns && this.columns.records) {for (var j = 0; j < this.columns.records.length; j++) {this._removecolumnhandlers(this.columns.records[j]);}}
var l = this.that;
var e = new b.jqx.collection(this.element);
var d = 0;
this._haspinned = false;
if (!this._columns) {this._columns = this.columns;} else {this.columns = this._columns;}
if (this.groupable) {
b.each(this.groups, function (i) {
var p = new c(l, this);
p.visibleindex = d++;
p.width = l.groupindentwidth;
e.add(p);
p.grouped = true;
p.filterable = false;
p.sortable = false;
p.editable = false;
p.resizable = false;
p.draggable = false;
});
}
if (this.rowdetails && this.showrowdetailscolumn) {
var g = new c(l, this);
g.visibleindex = d++;
g.width = l.groupindentwidth;
g.pinned = true;
g.editable = false;
g.filterable = false;
g.draggable = false;
g.groupable = false;
g.resizable = false;
e.add(g);
l._haspinned = true;
}
if (this.selectionmode == "checkbox") {
var g = new c(l, null);
g.visibleindex = d++;
g.width = l.groupindentwidth;
g.checkboxcolumn = true;
g.editable = false;
g.columntype = "checkbox";
g.groupable = false;
g.draggable = false;
g.filterable = false;
g.resizable = false;
g.datafield = "_checkboxcolumn";
e.add(g);
}
var n = new Array();
b.each(this.columns, function (i) {
if (l.columns[i] != undefined) {
var p = new c(l, this);
p.visibleindex = d++;
if (this.dataField != undefined) {this.datafield = this.dataField;}
if (this.pinned) {l._haspinned = true;}
if (l.showeverpresentrow) {
if (this.datafield === "addButtonColumn" || this.datafield === "resetButtonColumn" || this.datafield === "updateButtonColumn" || this.datafield === "deleteButtonColumn") {
p.editable = false;
p.groupable = false;
p.draggable = false;
p.filterable = false;
p.resizable = false;
p.menu = false;
}
}
if (this.datafield == null) {
if (l.source && l.source._source && (l.source._source.datatype == "array")) {
if (!k) {
if (!l.source._source.datafields) {
l.source._source.datafields = new Array();
l.source._source.datafields.push({ name: i.toString() });
} else {l.source._source.datafields.push({ name: i.toString() });}
}
this.datafield = i.toString();
this.displayfield = i.toString();
p.datafield = this.datafield;
p.displayfield = this.displayfield;
}
} else {
if (n[this.datafield]) {
throw new Error("jqxGrid: Invalid column 'datafield' setting. jqxGrid's columns should be initialized with unique data fields.");
l.host.remove();
return false;
} else {n[this.datafield] = true;}
}
e.add(p);
}
});
if (this.adaptive) {
var g = new c(l, null);
g.visibleindex = d++;
g.width = l.groupindentwidth;
g.editable = false;
g.columntype = "adaptive";
g.cellsalign = "center";
g.groupable = false;
g.draggable = false;
g.menu = false;
g.sortable = false;
g.filterable = false;
g.resizable = false;
g.datafield = "_adaptivecolumn";
e.add(g);
}
if (this.rtl) {e.records.reverse();}
this.columns = e;
},
_initializeRows: function () {
var d = new b.jqx.collection(this.element);
if (this.rows) {this.rows.clear();}
this.rows = d;
},
_raiseEvent: function (j, e) {
if (e == undefined) {e = { owner: null };}
if (this._trigger === false) {return;}
var f = this.events[j];
if (!this._camelCase) {f = f.toLowerCase();}
if (j == 2 || j == 15) {
if (this.showeverpresentrow && (this.everpresentrowactions.indexOf("delete") >= 0 || this.everpresentrowactions.indexOf("update") >= 0)) {
if (this.updateeverpresentrow) {var i = this;}
setTimeout(function () {i.updateeverpresentrow();}, 50);
}
}
var g = e;
g.owner = this;
var h = new b.Event(f);
h.owner = this;
h.args = g;
var d = this.host.trigger(h);
e = h.args;
return d;
},
wheel: function (f, e) {
if (e.autoheight && e.hScrollBar.css("visibility") != "visible") {
f.returnValue = true;
return true;
}
var g = 0;
if (!f) {f = window.event;}
if (f.originalEvent && f.originalEvent.wheelDelta) {f.wheelDelta = f.originalEvent.wheelDelta;}
if (f.wheelDelta) {g = f.wheelDelta / 120;} else {if (f.detail) {g = -f.detail / 3;}}
if (g) {
var d = e._handleDelta(g);
if (d) {
if (f.preventDefault) {f.preventDefault();}
if (f.originalEvent != null) {f.originalEvent.mouseHandled = true;}
if (f.stopPropagation != undefined) {f.stopPropagation();}
}
if (d) {
d = false;
f.returnValue = d;
return d;
} else {return false;}
}
if (f.preventDefault) {f.preventDefault();}
f.returnValue = false;
},
_handleDelta: function (f) {
if (this.vScrollBar.css("visibility") != "hidden") {
var e = this.vScrollInstance.value;
if (f < 0) {this.scrollDown();} else {this.scrollUp();}
var d = this.vScrollInstance.value;
if (e != d) {return true;}
} else {
if (this.hScrollBar.css("visibility") != "hidden") {
var e = this.hScrollInstance.value;
if (f > 0) {if (this.hScrollInstance.value > 2 * this.horizontalscrollbarstep) {this.hScrollInstance.setPosition(this.hScrollInstance.value - 2 * this.horizontalscrollbarstep);} else {this.hScrollInstance.setPosition(0);}} else {if (this.hScrollInstance.value < this.hScrollInstance.max) {this.hScrollInstance.setPosition(this.hScrollInstance.value + 2 * this.horizontalscrollbarstep);} else {this.hScrollInstance.setPosition(this.hScrollInstance.max);}}
var d = this.hScrollInstance.value;
if (e != d) {return true;}
}
}
return false;
},
scrollDown: function () {
if (this.vScrollBar.css("visibility") == "hidden") {return;}
var d = this.vScrollInstance;
if (d.value + this.rowsheight <= d.max) {d.setPosition(parseInt(d.value) + this.rowsheight);} else {d.setPosition(d.max);}
},
scrollUp: function () {
if (this.vScrollBar.css("visibility") == "hidden") {return;}
var d = this.vScrollInstance;
if (d.value - this.rowsheight >= d.min) {d.setPosition(parseInt(d.value) - this.rowsheight);} else {d.setPosition(d.min);}
},
_removeHandlers: function () {
var d = this.that;
d.removeHandler(b(window), "orientationchange.jqxgrid" + d.element.id);
d.removeHandler(b(window), "orientationchanged.jqxgrid" + d.element.id);
d.removeHandler(d.vScrollBar, "valueChanged");
d.removeHandler(d.hScrollBar, "valueChanged");
d.vScrollInstance.valueChanged = null;
d.hScrollInstance.valueChanged = null;
var e = "mousedown.jqxgrid";
if (d.isTouchDevice()) {e = b.jqx.mobile.getTouchEventName("touchend");}
d.removeHandler(d.host, "dblclick.jqxgrid");
d.removeHandler(d.host, e);
d.removeHandler(d.content, "mousemove", d._mousemovefunc);
d.removeHandler(d.host, "mouseleave.jqxgrid");
d.removeHandler(d.content, "mouseenter");
d.removeHandler(d.content, "mouseleave");
d.removeHandler(d.content, "mousedown");
d.removeHandler(d.content, "scroll");
d.removeHandler(d.content, "selectstart." + d.element.id);
d.removeHandler(d.host, "dragstart." + d.element.id);
d.removeHandler(d.host, "keydown.edit" + d.element.id);
d.removeHandler(b(document), "keydown.edit" + d.element.id);
d.removeHandler(b(document), "keyup.edit" + d.element.id);
if (d._mousemovedocumentfunc) {d.removeHandler(b(document), "mousemove.selection" + d.element.id, d._mousemovedocumentfunc);}
d.removeHandler(b(document), "mouseup.selection" + d.element.id);
if (d._mousewheelfunc) {d.removeHandler(d.host, "mousewheel", d._mousewheelfunc);}
if (d.editable) {d.removeHandler(b(document), "mousedown.gridedit" + d.element.id);}
if (d.host.off) {
d.content.off("mousemove");
d.host.off("mousewheel");
}
},
_addHandlers: function () {
var e = this.that;
var d = e.isTouchDevice();
if (!d) {e.addHandler(e.host, "dragstart." + e.element.id, function (j) {return false;});}
if (e.scrollbarautoshow) {
e.addHandler(e.host, "mouseenter.gridscroll" + e.element.id, function (j) {
e.vScrollBar.fadeIn("fast");
e.hScrollBar.fadeIn("fast");
});
e.addHandler(e.host, "mouseleave.gridscroll" + e.element.id, function (j) {
if (!e.vScrollInstance.isScrolling() && !e.hScrollInstance.isScrolling()) {
e.vScrollBar.fadeOut("fast");
e.hScrollBar.fadeOut("fast");
}
});
}
if (e.editable) {
e.addHandler(b(document), "mousedown.gridedit" + e.element.id, function (m) {
if (e.editable && e.begincelledit) {
if (e.editcell) {
if (!e.vScrollInstance.isScrolling() && !e.vScrollInstance.isScrolling()) {
var r = e.host.coord();
var q = e.host.width();
var n = e.host.height();
var v = false;
var k = false;
var t = false;
if (m.pageY < r.top || m.pageY > r.top + n) {
v = true;
k = true;
}
if (m.pageX < r.left || m.pageX > r.left + q) {
v = true;
t = true;
}
if (v) {
var u = false;
if (e.editcell && e.editcell.editor) {
switch (e.editcell.columntype) {
case"datetimeinput":
if (e.editcell.editor.jqxDateTimeInput && e.editcell.editor.jqxDateTimeInput("container") && e.editcell.editor.jqxDateTimeInput("container")[0].style.display == "block") {
var s = e.editcell.editor.jqxDateTimeInput("container").coord().top;
var j = e.editcell.editor.jqxDateTimeInput("container").coord().top + e.editcell.editor.jqxDateTimeInput("container").height();
if (k && (m.pageY < s || m.pageY > j)) {
v = true;
e.editcell.editor.jqxDateTimeInput("close");
} else {return;}
}
break;
case"combobox":
if (e.editcell.editor.jqxComboBox && e.editcell.editor.jqxComboBox("container") && e.editcell.editor.jqxComboBox("container")[0].style.display == "block") {
var s = e.editcell.editor.jqxComboBox("container").coord().top;
var j = e.editcell.editor.jqxComboBox("container").coord().top + e.editcell.editor.jqxComboBox("container").height();
if (k && (m.pageY < s || m.pageY > j)) {
v = true;
e.editcell.editor.jqxComboBox("close");
} else {return;}
}
break;
case"dropdownlist":
if (e.editcell.editor.jqxDropDownList && e.editcell.editor.jqxDropDownList("container") && e.editcell.editor.jqxDropDownList("container")[0].style.display == "block") {
var s = e.editcell.editor.jqxDropDownList("container").coord().top;
var j = e.editcell.editor.jqxDropDownList("container").coord().top + e.editcell.editor.jqxDropDownList("container").height();
if (k && (m.pageY < s || m.pageY > j)) {
v = true;
e.editcell.editor.jqxDropDownList("close");
} else {return;}
}
break;
case"template":
case"custom":
var l = ["jqxDropDownList", "jqxComboBox", "jqxDropDownButton", "jqxDateTimeInput"];
var p = function (A) {
var z = e.editcell.editor.data();
if (z[A] && z[A].instance.container && z[A].instance.container[0].style.display == "block") {
var x = z[A].instance;
var B = x.container.coord().top;
var y = x.container.coord().top + x.container.height();
if (k && (m.pageY < B || m.pageY > y)) {
v = true;
x.close();
return true;
} else {return false;}
}
};
for (var o = 0; o < l.length; o++) {
var w = p(l[o]);
if (w == false) {return;}
}
break;
}
}
e.endcelledit(e.editcell.row, e.editcell.column, false, true);
e._oldselectedcell = null;
}
}
}
}
});
}
e.vScrollInstance.valueChanged = function (j) {
if (e.virtualsizeinfo) {
e._closemenu();
if (e.scrollmode != "physical") {
e._renderrows(e.virtualsizeinfo);
e.currentScrollValue = j.currentValue;
} else {
if (e.currentScrollValue != undefined && Math.abs(e.currentScrollValue - j.currentValue) >= 5) {
e._renderrows(e.virtualsizeinfo);
e.currentScrollValue = j.currentValue;
} else {
e._renderrows(e.virtualsizeinfo);
e.currentScrollValue = j.currentValue;
}
}
if (!e.pageable && !e.groupable && e.dataview.virtualmode) {
if (e.loadondemandupdate) {clearTimeout(e.loadondemandupdate);}
e.loadondemandupdate = setTimeout(function () {
e.loadondemand = true;
e._renderrows(e.virtualsizeinfo);
}, 100);
}
if (d) {e._lastScroll = new Date();}
}
};
e.hScrollInstance.valueChanged = function (l) {
if (e.virtualsizeinfo) {
e._closemenu();
var k = function () {
e._renderhorizontalscroll();
e._renderrows(e.virtualsizeinfo);
if (e.editcell && !e.editrow) {if (e._showcelleditor && e.editcell.editing) {if (!e.hScrollInstance.isScrolling()) {e._showcelleditor(e.editcell.row, e.getcolumn(e.editcell.column), e.editcell.element, e.editcell.init);}}}
};
if (d) {k();} else {
var j = e._browser == undefined ? e._isIE10() : e._browser;
if (navigator && navigator.userAgent.indexOf("Safari") != -1 && navigator.userAgent.indexOf("Chrome") == -1) {
if (e._hScrollTimer) {clearTimeout(e._hScrollTimer);}
e._hScrollTimer = setTimeout(function () {k();}, 1);
} else {
if (b.jqx.browser.msie) {
if (e._hScrollTimer) {clearTimeout(e._hScrollTimer);}
e._hScrollTimer = setTimeout(function () {k();}, 0.01);
} else {k();}
}
}
if (d) {e._lastScroll = new Date();}
}
};
e._mousewheelfunc = e._mousewheelfunc || function (j) {
if (!e.editcell && e.enablemousewheel) {
e.wheel(j, e);
return false;
}
};
e.removeHandler(e.host, "mousewheel", e._mousewheelfunc);
e.addHandler(e.host, "mousewheel", e._mousewheelfunc);
var h = "mousedown.jqxgrid";
if (d) {h = b.jqx.mobile.getTouchEventName("touchend");}
e.addHandler(e.host, h, function (k) {
if (e.isTouchDevice()) {
e._newScroll = new Date();
if (e._newScroll - e._lastScroll < 500) {return false;}
if (b(k.target).ischildof(e.vScrollBar)) {return false;}
if (b(k.target).ischildof(e.hScrollBar)) {return false;}
}
e._mousedown = new Date();
var j = e._handlemousedown(k, e);
if (e.isNestedGrid) {if (!e.resizablecolumn && !e.columnsreorder) {k.stopPropagation();}}
e._lastmousedown = new Date();
return j;
});
if (!d) {
e.addHandler(e.host, "dblclick.jqxgrid", function (k) {
if (e.editable && e.begincelledit && e.editmode == "dblclick") {e._handledblclick(k, e);} else {if (b.jqx.browser.msie && b.jqx.browser.version < 9) {var j = e._handlemousedown(k, e);}}
e.mousecaptured = false;
e._lastmousedown = new Date();
return true;
});
e._mousemovefunc = function (j) {if (e._handlemousemove) {return e._handlemousemove(j, e);}};
e.addHandler(e.content, "mousemove", e._mousemovefunc);
if (e._handlemousemoveselection) {
e._mousemovedocumentfunc = function (j) {if (e._handlemousemoveselection) {return e._handlemousemoveselection(j, e);}};
e.addHandler(b(document), "mousemove.selection" + e.element.id, e._mousemovedocumentfunc);
}
e.addHandler(b(document), "mouseup.selection" + e.element.id, function (j) {if (e._handlemouseupselection) {e._handlemouseupselection(j, e);}});
}
try {
if (document.referrer != "" || window.frameElement) {
if (window.top != null && window.top != window.self) {
var i = null;
if (window.parent && document.referrer) {i = document.referrer;}
if (i && i.indexOf(document.location.host) != -1) {
var g = function (k) {if (e._handlemouseupselection) {try {e._handlemouseupselection(k, e);} catch (j) {}}};
e.addHandler(b(window.top.document), "mouseup.grid" + e.element.id, g);
}
}
}
} catch (f) {}
e.focused = false;
if (!d) {
e.addHandler(e.content, "mouseenter", function (j) {
e.focused = true;
if (e.wrapper) {
e.wrapper.attr("tabindex", 1);
e.content.attr("tabindex", 2);
}
if (e._overlayElement) {if (e.vScrollInstance.isScrolling() || e.hScrollInstance.isScrolling()) {e._overlayElement[0].style.visibility = "visible";} else {e._overlayElement[0].style.visibility = "hidden";}}
});
e.addHandler(e.content, "mouseleave", function (j) {
if (e._handlemousemove) {if (e.enablehover) {e._clearhoverstyle();}}
if (e._overlayElement) {e._overlayElement[0].style.visibility = "hidden";}
e.focused = false;
});
if (e.groupable || e.columnsreorder) {e.addHandler(b(document), "selectstart." + e.element.id, function (j) {if (e.__drag === true) {return false;}});}
e.addHandler(e.content, "selectstart." + e.element.id, function (j) {
if (e.enablebrowserselection) {return true;}
if (e.showfilterrow) {if (b(j.target).ischildof(e.filterrow)) {return true;}}
if (e.showeverpresentrow) {
if (b(j.target).ischildof(e.addnewrow)) {return true;}
if (e.addnewrowtop) {if (b(j.target).ischildof(e.addnewrowtop)) {return true;}}
}
if (j.target.className && j.target.className.indexOf("jqx-grid-widget") >= 0) {return true;}
if (!e.editcell) {return false;}
if (j.stopPropagation) {j.stopPropagation();}
});
e.addHandler(b(document), "keyup.edit" + e.element.id, function (j) {e._keydown = false;});
e.addHandler(b(document), "keydown.edit" + e.element.id, function (l) {
if (e.adaptiveview) {return true;}
e._keydown = true && !e.editcell;
var k = l.charCode ? l.charCode : l.keyCode ? l.keyCode : 0;
if (k === 20) {if (!e._capsLock) {e._capsLock = true;} else {e._capsLock = false;}}
if (e.handlekeyboardnavigation) {
if (e.focused || (l.target === e.element || b(l.target).ischildof(e.host))) {
var m = e.handlekeyboardnavigation(l);
if (m == true) {return false;}
}
}
if (e.editable && e.editcell) {if (k == 13 || k == 27 || k == 9 || k == 32) {if (e._handleeditkeydown) {j = e._handleeditkeydown(l, e);}}}
if (k == 27) {
e.mousecaptured = false;
if (e.selectionarea.css("visibility") == "visible") {e.selectionarea.css("visibility", "hidden");}
}
if (b.jqx.browser.msie && b.jqx.browser.version < 12 && e.focused && !e.isNestedGrid) {
if (k == 13 && j == false) {return j;}
var j = true;
var k = l.charCode ? l.charCode : l.keyCode ? l.keyCode : 0;
if (!e.editcell && e.editable && e.editmode != "programmatic") {if (e._handleeditkeydown) {j = e._handleeditkeydown(l, e);}}
if (j && e.keyboardnavigation && e._handlekeydown) {
j = e._handlekeydown(l, e);
if (!j) {
if (l.preventDefault) {l.preventDefault();}
if (l.stopPropagation != undefined) {l.stopPropagation();}
}
return j;
}
}
return true;
});
e.addHandler(e.host, "keyup.edit" + e.element.id, function (k) {
if (e.adaptiveview) {return true;}
if (k.keyCode === 9) {
if (!b(document.activeElement).ischildof(e.filterrow)) {
if (!b(document.activeElement).ischildof(e.pager)) {
switch (e.selectionmode) {
case"singlecell":
case"multiplecells":
case"multiplecellsextended":
case"multiplecellsadvanced":
var j = e.getselectedcell();
if (j === null) {e.selectcell(0, e.columns.records[0].displayfield);}
break;
default:
var l = e.getselectedrowindex();
if (l === -1) {e.selectrow(0);}
break;
}
}
}
}
});
e.addHandler(e.host, "keydown.edit" + e.element.id, function (l) {
var j = true;
if (e.adaptiveview) {return true;}
if (e.handlekeyboardnavigation) {
var m = e.handlekeyboardnavigation(l);
if (m == true) {return false;}
}
if (e.editable && e.editmode != "programmatic") {
if (e._handleeditkeydown) {
j = e._handleeditkeydown(l, e);
if (e.isNestedGrid) {l.stopPropagation();}
}
}
if (!e.editcell && l.altKey) {
if (!b(document.activeElement).ischildof(e.filterrow)) {
if (!b(document.activeElement).ischildof(e.pager)) {
if (l.keyCode === 40) {
var k = e.getselectedcell();
if (k) {e.openmenu(k.column);}
} else {if (l.keyCode === 38) {e._closemenu();}}
}
}
}
if (!(b.jqx.browser.msie && b.jqx.browser.version < 8)) {
if (j && e.keyboardnavigation && e._handlekeydown) {
j = e._handlekeydown(l, e);
if (e.isNestedGrid) {l.stopPropagation();}
}
} else {
if (e.isNestedGrid) {
if (j && e.keyboardnavigation && e._handlekeydown) {
j = e._handlekeydown(l, e);
l.stopPropagation();
}
}
}
if (!j) {
if (l.preventDefault) {l.preventDefault();}
if (l.stopPropagation != undefined) {l.stopPropagation();}
}
if (j && e.selectedcells && e.selectedcells.length > 0) {if (l.keyCode === 9 && l.shiftKey && e.table && e.table[0].rows && e.table[0].rows.length > 0) {if (!b(document.activeElement).ischildof(e.filterrow)) {if (!b(document.activeElement).ischildof(e.pager)) {e.table[0].rows[0].cells[0].focus();}}}}
return j;
});
}
},
_hittestrow: function (s, q) {
if (this.vScrollInstance == null || this.hScrollInstance == null) {return;}
if (s == undefined) {s = 0;}
if (q == undefined) {q == 0;}
var l = this.vScrollInstance;
var k = this.hScrollInstance;
var f = l.value;
if (this.vScrollBar.css("visibility") != "visible") {f = 0;}
var m = k.value;
if (this.hScrollBar.css("visibility") != "visible") {m = 0;}
if (this.scrollmode == "deferred" && this._newmax != null) {if (f > this._newmax) {f = this._newmax;}}
var r = parseInt(f) + q;
var j = parseInt(m) + s;
if (this.visiblerows == null) {return;}
if (this.visiblerows.length == 0) {return;}
var e = false;
var i = this._findvisiblerow(r, this.visiblerows);
if (i >= 0) {
var o = this.visiblerows[i];
var d = this.rowdetails && o.rowdetails;
var n = !o.rowdetailshidden;
if (d) {
var g = this.visiblerows[i - 1];
if (g == o) {
o = g;
i--;
}
if (n) {
var h = b(this.hittestinfo[i].visualrow).position().top + parseInt(this.table.css("top"));
var p = b(this.hittestinfo[i].visualrow).height();
if (!(q >= h && q <= h + p)) {
i++;
o = this.visiblerows[i];
e = true;
}
}
}
}
return { index: i, row: o, details: e };
},
getcellatposition: function (j, q) {
var r = this.that;
var z = this.showheader ? this.columnsheader.height() + 2 : 0;
var s = this._groupsheader() ? this.groupsheader.height() : 0;
var B = this.showtoolbar ? this.toolbarheight : 0;
s += B;
var g = this.host.coord();
if (this.hasTransform) {g = b.jqx.utilities.getOffset(this.host);}
var p = j - g.left;
var n = q - z - g.top - s;
var d = this._hittestrow(p, n);
var k = d.row;
var l = d.index;
var t = this.table[0].rows[l];
if (this.dataview && this.dataview.records.length == 0) {
var o = this.table[0].rows;
var C = 0;
for (var w = 0; w < o.length; w++) {
if (n >= C && n < C + this.rowsheight) {
t = o[w];
break;
}
C += this.rowsheight;
}
k = { boundindex: w };
}
if (t == null) {return true;}
var u = this.hScrollInstance;
var v = u.value;
var f = 0;
var m = this.groupable ? this.groups.length : 0;
for (var w = 0; w < t.cells.length; w++) {
var h = parseInt(b(this.columnsrow[0].cells[w]).css("left"));
var j = h - v;
if (r.columns.records[w].pinned) {j = h;}
if (r.columns.records[w].hidden || r.columns.records[w].adaptivehidden) {continue;}
var A = j + b(this.columnsrow[0].cells[w]).width();
if (A >= p && p >= j) {
f = w;
break;
}
}
if (k != null) {
var e = this._getcolumnat(f);
return { row: this.getboundindex(k), column: e.datafield, value: this.getcellvalue(this.getboundindex(k), e.datafield) };
}
return null;
},
_handlemousedown: function (Y, n) {
if (Y.target == null) {return true;}
if (n.disabled) {return true;}
if (b(Y.target).ischildof(this.columnsheader) || b(Y.target).ischildof(this.hScrollBar) || b(Y.target).ischildof(this.vScrollBar)) {return true;}
if (Y.target === n.bottomRight[0]) {return true;}
var o;
if (Y.which) {o = (Y.which == 3);} else {if (Y.button) {o = (Y.button == 2);}}
var R;
if (Y.which) {R = (Y.which == 2);} else {if (Y.button) {R = (Y.button == 1);}}
if (R) {return true;}
if (this.adaptiveview) {
if (b(Y.target).ischildof(b(this.adaptiveview))) {return true;}
if (Y.target == this.adaptiveview) {return true;}
}
if (this.showstatusbar) {
if (b(Y.target).ischildof(this.statusbar)) {return true;}
if (Y.target == this.statusbar[0]) {return true;}
}
if (this.showtoolbar) {
if (b(Y.target).ischildof(this.toolbar)) {return true;}
if (Y.target == this.toolbar[0]) {return true;}
}
if (this.pageable) {
if (b(Y.target).ischildof(this.pager)) {return true;}
if (Y.target == this.pager[0]) {return true;}
}
if (!this.columnsheader) {return true;}
if (!this.editcell) {if (this.pageable) {if (b(Y.target).ischildof(this.pager)) {return true;}}}
var W = this.showheader ? this.columnsheader.height() + 2 : 0;
var C = this._groupsheader() ? this.groupsheader.height() : 0;
var F = this.showtoolbar ? this.toolbarheight : 0;
C += F;
var U = this.host.coord();
if (this.hasTransform) {
U = b.jqx.utilities.getOffset(this.host);
var ab = this._getBodyOffset();
U.left -= ab.left;
U.top -= ab.top;
}
var k = parseInt(Y.pageX);
var l = parseInt(Y.pageY);
if (this.isTouchDevice()) {
var Z = n.getTouches(Y);
var Q = Z[0];
k = parseInt(Q.pageX);
l = parseInt(Q.pageY);
if (n.touchmode == true) {
if (Q._pageX != undefined) {
k = parseInt(Q._pageX);
l = parseInt(Q._pageY);
}
}
}
var J = k - U.left;
var I = l - W - U.top - C;
if (this.pageable && !this.autoheight && this.gotopage) {
var d = this.pager.coord().top - U.top - C - W;
if (I > d) {return;}
}
var V = this._hittestrow(J, I);
if (!V) {return;}
if (V.details) {return;}
var r = V.row;
var E = V.index;
var s = Y.target.className;
var j = this.table[0].rows[E];
if (j == null) {
if (n.editable && n.begincelledit) {if (n.editcell) {n.endcelledit(n.editcell.row, n.editcell.column, false, true);}}
return true;
}
n.mousecaptured = true;
n.mousecaptureposition = { left: Y.pageX, top: Y.pageY - C, clickedrow: j };
var m = this.hScrollInstance;
var u = m.value;
if (this.rtl) {if (this.hScrollBar.css("visibility") != "hidden") {u = m.max - m.value;}}
var G = -1;
var D = this.groupable ? this.groups.length : 0;
if (this.rtl) {
if (this.vScrollBar[0].style.visibility != "hidden") {u -= this.scrollbarsize + 4;}
if (this.hScrollBar[0].style.visibility == "hidden") {u = -parseInt(this.content.css("left"));}
}
for (var S = 0; S < j.cells.length; S++) {
var T = parseInt(b(this.columnsrow[0].cells[S]).css("left"));
var k = T - u;
if (n.columns.records[S].pinned && !n.rtl) {k = T;}
var L = this._getcolumnat(S);
if (L != null && L.hidden) {continue;}
if (L != null && L.adaptivehidden) {continue;}
var N = k + b(this.columnsrow[0].cells[S]).width();
if (N >= J && J >= k) {
G = S;
n.mousecaptureposition.clickedcell = S;
break;
}
}
if (this.rtl && this._haspinned) {
for (var S = j.cells.length - 1; S >= 0; S--) {
if (!n.columns.records[S].pinned) {break;}
var T = b(this.columnsrow[0].cells[S]).coord().left - this.host.coord().left;
var k = T;
var L = this._getcolumnat(S);
if (L != null && L.hidden) {continue;}
if (L != null && L.adaptivehidden) {continue;}
var N = k + b(this.columnsrow[0].cells[S]).width();
if (N >= J && J >= k) {
G = S;
n.mousecaptureposition.clickedcell = S;
break;
}
}
}
if (r != null && G >= 0) {
this._raiseEvent(1, { rowindex: this.getboundindex(r), visibleindex: r.visibleindex, row: r, group: r.group, rightclick: o, originalEvent: Y });
var L = this._getcolumnat(G);
var O = this.getcellvalue(this.getboundindex(r), L.datafield);
if (this.editable && this.editcell) {
this._currentEditableColumn = G;
if (L.datafield == this.editcell.column) {if (this.getboundindex(r) == this.editcell.row) {this.mousecaptured = false;}}
}
if (L.columntype === "adaptive") {
var K = document.createElement("div");
var aa = document.createElement("div");
var A = document.createElement("a");
var w = document.createElement("a");
var f = document.createElement("div");
var M = this.getrowdata(this.getboundindex(r));
A.href = "#";
w.href = "#";
K.style.zIndex = 99999;
K.style.position = "absolute";
K.style.left = "0px";
K.style.top = "0px";
K.style.width = "100%";
K.style.height = "100%";
K.className = "jqx-adaptive-view jqx-widget-content";
f.style.position = "relative";
f.style.top = "100%";
f.style.textAlign = "center";
f.style.marginTop = "-40px";
aa.style.position = "absolute";
aa.style.left = "0px";
aa.style.top = "0px";
aa.style.width = "100%";
aa.style.height = "100%";
if (this.theme) {K.className = "jqx-widget-content jqx-widget-content-" + this.theme;}
var e = document.createElement("span");
e.className = "jqx-icon-close";
if (this.theme) {e.className = "jqx-icon-close jqx-widget-close-" + this.theme;}
e.style.zIndex = 99;
e.style.position = "absolute";
e.style.right = "10px";
e.style.top = "10px";
e.style.width = "16px";
e.style.height = "16px";
K.appendChild(aa);
K.appendChild(e);
A.innerHTML = this.gridlocalization.okstring;
w.innerHTML = this.gridlocalization.cancelstring;
A.addEventListener("mousedown", function (ad) {
var af = {};
var x = n.adaptiveview.querySelectorAll("input");
for (var y = 0; y < x.length; y++) {
var ae = x[y].value;
var ac = x[y].getAttribute("data-column");
af[ac] = ae;
}
n.updaterow(M.uid, af);
K.parentNode.removeChild(K);
n.adaptiveview = null;
ad.stopPropagation();
return false;
});
w.addEventListener("mousedown", function () {
K.parentNode.removeChild(K);
n.adaptiveview = null;
Y.stopPropagation();
return false;
});
if (this.editable) {
f.appendChild(A);
f.appendChild(w);
K.appendChild(f);
}
var v = "
";
aa.innerHTML = v;
e.addEventListener("mousedown", function (i) {
K.parentNode.removeChild(K);
n.adaptiveview = null;
});
this.wrapper[0].appendChild(K);
this.adaptiveview = K;
b(this.adaptiveview).find(".jqx-grid-column-filterbutton").on("click", function () {
var i = this.getAttribute("datafield");
var x = this.offsetTop;
n.openmenu(i);
setTimeout(function () {
n.gridmenu.css("top", 30 + x);
n.gridmenu.css("left", 25);
n.gridmenu.css("z-index", 99999);
n.gridmenu.parent().css("z-index", 99999);
}, 300);
});
return;
}
this._raiseEvent(8, { rowindex: this.getboundindex(r), column: L ? L.getcolumnproperties() : null, row: r, visibleindex: r.visibleindex, datafield: L ? L.datafield : null, columnindex: G, value: O, rightclick: o, originalEvent: Y });
if (L.createwidget) {return true;}
if (this.isTouchDevice()) {
if (L.columntype == "checkbox" && this.editable && this._overlayElement) {
if (!this.editcell) {
this._overlayElement.css("visibility", "hidden");
this.editcell = this.getcell(E, L.datafield);
return true;
}
} else {
if (L.columntype == "button" && this._overlayElement) {
if (L.buttonclick) {L.buttonclick(j.cells[G].buttonrow, Y);}
return true;
}
}
}
var h = false;
if (this._lastmousedown != null) {
if (this._mousedown - this._lastmousedown < 300) {
if (this._clickedrowindex == this.getboundindex(r)) {
this._raiseEvent(22, { rowindex: this.getboundindex(r), row: r, visibleindex: r.visibleindex, group: r.group, rightclick: o, originalEvent: Y });
if (this._clickedcolumn == L.datafield) {this._raiseEvent(23, { rowindex: this.getboundindex(r), row: r, visibleindex: r.visibleindex, column: L ? L.getcolumnproperties() : null, datafield: L ? L.datafield : null, columnindex: G, value: O, rightclick: o, originalEvent: Y });}
h = true;
this._clickedrowindex = -1;
this._clickedcolumn = null;
if (Y.isPropagationStopped && Y.isPropagationStopped()) {return false;}
}
}
}
if (o) {return true;}
if (!h) {
this._clickedrowindex = this.getboundindex(r);
this._clickedcolumn = L.datafield;
}
var g = b.jqx.utilities.getBrowser();
if (g.browser == "msie" && parseInt(g.version) <= 7) {
if (G == 0 && this.rowdetails) {s = "jqx-grid-group-collapse";}
if (D > 0) {if (G <= D) {s = "jqx-grid-group-collapse";}}
}
if (s.indexOf("jqx-grid-group-expand") != -1 || s.indexOf("jqx-grid-group-collapse") != -1) {
if (!this.rtl) {
if (D > 0 && G < D && this._togglegroupstate) {this._togglegroupstate(r.bounddata, true);} else {
if (G == D && this.rowdetails && this.showrowdetailscolumn) {
this._togglerowdetails(r.bounddata, true);
this.gridcontent[0].scrollTop = 0;
this.gridcontent[0].scrollLeft = 0;
}
}
} else {
if (D > 0 && G > j.cells.length - D - 1 && this._togglegroupstate) {this._togglegroupstate(r.bounddata, true);} else {
if (G == j.cells.length - 1 - D && this.rowdetails && this.showrowdetailscolumn) {
this._togglerowdetails(r.bounddata, true);
this.gridcontent[0].scrollTop = 0;
this.gridcontent[0].scrollLeft = 0;
}
}
}
} else {
if (r.boundindex != -1) {
var p = this.selectedrowindexes.slice(0);
var X = false;
if (n.selectionmode != "none" && n.selectionmode != "checkbox" && this._selectrowwithmouse) {
if (n.selectionmode == "multiplecellsadvanced" || n.selectionmode == "multiplecellsextended" || n.selectionmode == "multiplerowsextended" || n.selectionmode == "multiplerowsadvanced") {
if (!Y.ctrlKey && !Y.shiftKey && !Y.metaKey) {
n.selectedrowindexes = new Array();
n.selectedcells = new Array();
}
}
var z = false;
var q = this.getboundindex(r);
if (n._oldselectedrow === q || n.selectionmode === "none") {z = true;}
if (n.selectionmode.indexOf("cell") == -1) {
if ((n.selectionmode != "singlerow") || (n.selectedrowindex != q && n.selectionmode == "singlerow")) {
this._applyrowselection(q, true, false, null, L.datafield);
this._selectrowwithmouse(n, V, p, L.datafield, Y.ctrlKey || Y.metaKey, Y.shiftKey);
}
} else {
if (L.datafield != null) {
this._selectrowwithmouse(n, V, p, L.datafield, Y.ctrlKey || Y.metaKey, Y.shiftKey);
if (!Y.shiftKey) {this._applycellselection(q, L.datafield, true, false);}
}
}
if (n._oldselectedcell) {if (n._oldselectedcell.datafield == n.selectedcell.datafield && n._oldselectedcell.rowindex == n.selectedcell.rowindex) {X = true;}}
n._oldselectedcell = n.selectedcell;
n._oldselectedrow = q;
}
if (n.autosavestate) {if (n.savestate) {n.savestate();}}
if (n.editable && n.begincelledit && n.editmode != "programmatic") {
if (Y.isPropagationStopped && Y.isPropagationStopped()) {return false;}
if (n.editmode == "selectedrow") {
if (z && !n.editcell) {
if (L.columntype !== "checkbox") {
this._currentEditableColumn = G;
var t = n.beginrowedit(this.getboundindex(r));
}
} else {if (n.editcell && !z && n.selectionmode != "none") {var t = n.endrowedit(n.editcell.row);}}
} else {
var q = this.getboundindex(r);
var P = n.editmode == "click" || (X && n.editmode == "selectedcell");
if (n.selectionmode.indexOf("cell") == -1) {if (n.editmode != "dblclick") {P = true;}}
if (P) {
if (r.boundindex != undefined && L.editable) {
var t = n.begincelledit(this.getboundindex(r), L.datafield, L.defaulteditorvalue);
if (n.selectionmode.indexOf("cell") != -1) {n._applycellselection(q, L.datafield, false, false);}
}
}
if (n.selectionmode.indexOf("cell") != -1) {if (n.editmode == "selectedcell" && !X && n.editcell) {n.endcelledit(n.editcell.row, n.editcell.column, false, true);}}
if (n.editmode == "dblclick" && !X && n.editcell && !(n.editcell.row == q && L.datafield == n.editcell.column)) {n.endcelledit(n.editcell.row, n.editcell.column, false, true);}
}
return true;
}
}
}
}
return true;
},
_columnPropertyChanged: function (e, d, g, f) {},
_rowPropertyChanged: function (g, d, f, e) {},
_serializeObject: function (d) {
if (d == null) {return "";}
var e = "";
b.each(d, function (g) {
var i = this;
if (g > 0) {e += ", ";}
e += "[";
var f = 0;
for (var h in i) {
if (f > 0) {e += ", ";}
e += "{" + h + ":" + i[h] + "}";
f++;
}
e += "]";
});
return e;
},
isbindingcompleted: function () {return !this._loading;},
propertiesChangedHandler: function (d, e, f) {
if (f.width && f.height && Object.keys(f).length == 2) {
d._updatesize(true, true);
d._resizeWindow();
if (d.virtualmode && !d._loading) {d.vScrollInstance.setPosition(0);} else {setTimeout(function () {d._renderrows(d.virtualsizeinfo);}, 100);}
}
},
propertyChangedHandler: function (e, f, i, h) {
if (this.isInitialized == undefined || this.isInitialized == false) {return;}
if (e.batchUpdate && e.batchUpdate.width && e.batchUpdate.height && Object.keys(e.batchUpdate).length == 2) {return;}
f = f.toLowerCase();
switch (f) {
case"editable":
case"showcolumnheaderlines":
case"showcolumnlines":
case"showrowlines":
e.refresh();
break;
case"everpresentrowactionsmode":
if (i != h) {
e._removeaddnewrow();
e.render();
}
break;
case"everpresentrowactions":
e._updateaddnewrowui();
break;
case"showeverpresentrow":
case"everpresentrowposition":
case"everpresentrowheight":
if (i != h) {
e._removeaddnewrow();
e.render();
}
break;
case"rtl":
e.content.css("left", "");
e.columns = e._columns;
e._filterrowcache = [];
e.vScrollBar.jqxScrollBar({ rtl: h });
e.hScrollBar.jqxScrollBar({ rtl: h });
if (e._initpager) {e._initpager();}
if (e._initgroupsheader) {e._initgroupsheader();}
e.render();
break;
case"enablebrowserselection":
if (!e.showfilterrow) {
if (!e.showstatusbar && !e.showtoolbar) {e.host.addClass("jqx-disableselect");}
e.content.addClass("jqx-disableselect");
}
if (e.enablebrowserselection) {
e.content.removeClass("jqx-disableselect");
e.host.removeClass("jqx-disableselect");
}
break;
case"columnsheight":
if (e.columnsheight != 32 || e.columngroups) {e._measureElement("column");}
e._render(true, true, true, false, false);
break;
case"rowsheight":
if (h != i) {
if (e.rowsheight != 31) {e._measureElement("cell");}
e.virtualsizeinfo = null;
e.rendergridcontent(true, false);
e.refresh();
}
break;
case"scrollMode":
e.vScrollInstance.thumbStep = e.rowsheight;
break;
case"showdefaultloadelement":
e._builddataloadelement();
break;
case"showfiltermenuitems":
case"showsortmenuitems":
case"showgroupmenuitems":
case"filtermode":
e._initmenu();
break;
case"touchmode":
if (i != h) {
e._removeHandlers();
e.touchDevice = null;
e.vScrollBar.jqxScrollBar({ touchMode: h });
e.hScrollBar.jqxScrollBar({ touchMode: h });
e._updateTouchScrolling();
e._arrange();
e._updatecolumnwidths();
e._updatecellwidths();
e._addHandlers();
}
break;
case"autoshowcolumnsmenubutton":
if (i != h) {e._rendercolumnheaders();}
break;
case"rendergridrows":
if (i != h) {e.updatebounddata();}
break;
case"editmode":
if (i != h) {
e._removeHandlers();
e._addHandlers();
}
break;
case"source":
e.updatebounddata();
if (e.virtualmode && !e._loading) {
e.loadondemand = true;
e._renderrows(e.virtualsizeinfo);
}
break;
case"horizontalscrollbarstep":
case"verticalscrollbarstep":
case"horizontalscrollbarlargestep":
case"verticalscrollbarlargestep":
this.vScrollBar.jqxScrollBar({ step: this.verticalscrollbarstep, largestep: this.verticalscrollbarlargestep });
this.hScrollBar.jqxScrollBar({ step: this.horizontalscrollbarstep, largestep: this.horizontalscrollbarlargestep });
break;
case"closeablegroups":
if (e._initgroupsheader) {e._initgroupsheader();}
break;
case"showgroupsheader":
if (i != h) {
e._arrange();
if (e._initgroupsheader) {e._initgroupsheader();}
e._renderrows(e.virtualsizeinfo);
}
break;
case"theme":
if (h != i) {
b.jqx.utilities.setTheme(i, h, e.host);
if (e.gridmenu) {e.gridmenu.jqxMenu({ theme: h });}
if (e.pageable) {e._updatepagertheme();}
if (e.filterable) {e._updatefilterrowui(true);}
if (e.showeverpresentrow) {e._updateaddnewrowui(true);}
}
break;
case"showtoolbar":
case"toolbarheight":
if (i != h) {
e._arrange();
e.refresh();
}
break;
case"showstatusbar":
if (i != h) {
if (e.statusbar) {if (h) {e.statusbar.show();} else {e.statusbar.hide();}}
e._arrange();
e.refresh();
}
break;
case"statusbarheight":
if (i != h) {
e._arrange();
e.refresh();
}
break;
case"filterable":
case"showfilterrow":
if (i != h) {e.render();}
break;
case"autoshowfiltericon":
case"showfiltercolumnbackground":
case"showpinnedcolumnbackground":
case"showsortcolumnbackground":
if (i != h) {e.rendergridcontent();}
break;
case"showrowdetailscolumn":
if (i != h) {e.render();}
break;
case"scrollbarsize":
if (i != h) {
b.jqx.utilities.scrollBarSize = h;
e._arrange();
}
break;
case"width":
case"height":
if (i != h) {
e._updatesize(true, true);
e._resizeWindow();
if (e.virtualmode && !e._loading) {e.vScrollInstance.setPosition(0);} else {setTimeout(function () {e._renderrows(e.virtualsizeinfo);}, 100);}
}
break;
case"altrows":
case"altstart":
case"altstep":
if (i != h) {e._renderrows(e.virtualsizeinfo);}
break;
case"groupsheaderheight":
if (i != h) {
e._arrange();
if (e._initgroupsheader) {e._initgroupsheader();}
}
break;
case"pagerheight":
if (i != h) {e._initpager();}
break;
case"selectedrowindex":
e.selectrow(h);
break;
case"selectionmode":
if (i != h) {
if (h == "none") {
e.selectedrowindexes = new Array();
e.selectedcells = new Array();
e.selectedrowindex = -1;
}
e._renderrows(e.virtualsizeinfo);
if (h == "checkbox") {e._render(false, false, true, false, false);}
}
break;
case"showheader":
if (h) {e.columnsheader.css("display", "block");} else {e.columnsheader.css("display", "none");}
break;
case"virtualmode":
if (i != h) {
e.dataview.virtualmode = e.virtualmode;
e.dataview.refresh(false);
e._render(false, false, false);
}
break;
case"columnsmenu":
if (i != h) {e.render();}
break;
case"columngroups":
e._render(true, true, true, false, false);
break;
case"columns":
if (e.columns && e.columns.length > e.headerZIndex) {e.headerZIndex = e.columns.length + 100;}
if (e._serializeObject(e._cachedcolumns) !== e._serializeObject(h)) {
var d = false;
if (e.filterable) {
if (i && i.records) {
b.each(i.records, function () {
if (this.filter) {d = true;}
e.dataview.removefilter(this.displayfield, this.filter);
});
}
}
e._columns = null;
e._filterrowcache = [];
e.render();
if (d) {e.applyfilters();}
e._cachedcolumns = e.columns;
if (e.removesort) {e.removesort();}
} else {e[f] = i;}
break;
case"autoheight":
if (i != h) {e._render(false, false, true);}
break;
case"pagermode":
case"pagerbuttonscount":
if (i != h) {
if (e._initpager) {
if (e.pagershowrowscombo) {
e.pagershowrowscombo.jqxDropDownList("destroy");
e.pagershowrowscombo = null;
}
if (e.pagerrightbutton) {
e.removeHandler(e.pagerrightbutton, "mousedown");
e.removeHandler(e.pagerrightbutton, "mouseup");
e.removeHandler(e.pagerrightbutton, "click");
e.pagerrightbutton.jqxButton("destroy");
e.pagerrightbutton = null;
}
if (e.pagerleftbutton) {
e.removeHandler(e.pagerleftbutton, "mousedown");
e.removeHandler(e.pagerleftbutton, "mouseup");
e.removeHandler(e.pagerleftbutton, "click");
e.pagerleftbutton.jqxButton("destroy");
e.removeHandler(b(document), "mouseup.pagerbuttons" + e.element.id);
e.pagerleftbutton = null;
}
e.pagerdiv.remove();
e._initpager();
}
}
break;
case"pagesizeoptions":
case"pageable":
case"pagesize":
if (i != h) {
if (e._loading) {
throw new Error("jqxGrid: " + e.loadingerrormessage);
return;
}
if (!e.host.jqxDropDownList || !e.host.jqxListBox) {
e._testmodules();
return;
}
if (e._initpager) {
if (f != "pageable" && f != "pagermode") {
if (typeof (h) == "string") {
var g = "The expected value type is: Int.";
if (f != "pagesize") {var g = "The expected value type is: Array of Int values.";}
throw new Error("Invalid Value for: " + f + ". " + g);
}
}
e.dataview.pageable = e.pageable;
e.dataview.pagenum = 0;
e.dataview.pagesize = e._getpagesize();
if (e.virtualmode) {e.updatebounddata();}
e.dataview.refresh(true);
e._initpager();
if (f == "pagesizeoptions") {
if (h != null && h.length > 0) {
e.pagesize = parseInt(h[0]);
e.dataview.pagesize = parseInt(h[0]);
e.prerenderrequired = true;
e._requiresupdate = true;
e.dataview.pagenum = -1;
e.gotopage(0);
}
}
}
e._render(false, false, false);
}
break;
case"groups":
if (e._serializeObject(i) !== e._serializeObject(h)) {
e.dataview.groups = h;
e._refreshdataview();
e._render(true, true, true, false);
}
break;
case"groupable":
if (i != h) {
e.dataview.groupable = e.groupable;
e.dataview.pagenum = 0;
e.dataview.refresh(false);
e._render(false, false, true);
}
break;
case"renderstatusbar":
if (h != null) {e.renderstatusbar(e.statusbar);}
break;
case"rendertoolbar":
if (h != null) {e.rendertoolbar(e.toolbar);}
break;
case"disabled":
if (h) {e.host.addClass(e.toThemeProperty("jqx-fill-state-disabled"));} else {e.host.removeClass(e.toThemeProperty("jqx-fill-state-disabled"));}
b.jqx.aria(e, "aria-disabled", e.disabled);
if (e.pageable) {
if (e.pagerrightbutton) {
e.pagerrightbutton.jqxButton({ disabled: h });
e.pagerleftbutton.jqxButton({ disabled: h });
e.pagershowrowscombo.jqxDropDownList({ disabled: h });
e.pagergotoinput.attr("disabled", h);
}
if (e.pagerfirstbutton) {
e.pagerfirstbutton.jqxButton({ disabled: h });
e.pagerlastbutton.jqxButton({ disabled: h });
}
}
e.vScrollBar.jqxScrollBar({ disabled: h });
e.hScrollBar.jqxScrollBar({ disabled: h });
if (e.filterable && e.showfilterrow) {e._updatefilterrowui(true);}
if (e.showeverpresentrow) {e._updateaddnewrowui(true);}
break;
}
}
});
function c(d, e) {
this.owner = d;
this.datafield = null;
this.displayfield = null;
this.text = "";
this.createfilterpanel = null;
this.sortable = true;
this.hideable = true;
this.editable = true;
this.hidden = false;
this.adaptivehidden = false;
this.groupable = true;
this.renderer = null;
this.cellsrenderer = null;
this.checkchange = null, this.threestatecheckbox = false;
this.buttonclick = null, this.columntype = null;
this.cellsformat = "";
this.align = "left";
this.cellsalign = "left";
this.width = "auto";
this.minwidth = 25;
this.maxwidth = "auto";
this.pinned = false;
this.visibleindex = -1;
this.filterable = true;
this.filter = null;
this.filteritems = [];
this.resizable = true;
this.initeditor = null;
this.createeditor = null;
this.createwidget = null;
this.initwidget = null;
this.destroywidget = null;
this.destroyeditor = null;
this.geteditorvalue = null;
this.validation = null;
this.classname = "";
this.cellclassname = "";
this.cellendedit = null;
this.cellbeginedit = null;
this.cellvaluechanging = null;
this.aggregates = null;
this.aggregatesrenderer = null;
this.menu = true;
this.createfilterwidget = null;
this.filtertype = "default";
this.filtercondition = null;
this.rendered = null;
this.exportable = true;
this.exporting = false;
this.draggable = true;
this.nullable = true;
this.clipboard = true;
this.selectable = false;
this._applyStyle = function () {
var f = this;
if (f.hovered) {
if (f.style.headerBackgroundHoveredColor) {f.element.style.backgroundColor = f.style.headerBackgroundHoveredColor;}
if (f.style.headerHoveredColor) {f.element.style.color = f.style.headerHoveredColor;}
return;
}
if (f.selected) {
if (f.style.headerBackgroundSelectedColor) {f.element.style.backgroundColor = f.style.headerBackgroundSelectedColor;}
if (f.style.headerSelectedColor) {f.element.style.color = f.style.headerSelectedColor;}
return;
}
if (f.style.headerBackgroundColor) {f.element.style.backgroundColor = f.style.headerBackgroundColor;} else {f.element.style.backgroundColor = "";}
if (f.style.headerColor) {f.element.style.color = f.style.headerColor;} else {f.element.style.color = "";}
};
this._applyCellStyle = function (f) {
var j = this;
var g = false;
if (f.length) {
for (var h = 0; h < f.length; h++) {this._applyCellStyle(f[h]);}
return;
}
if (j.style.backgroundColor || j.style.color || j.style.hoveredColor || j.style.hoveredColor || j.style.backgroundSelectedColor || j.style.selectedColor) {g = true;}
if (!g) {return;}
if (f.className.indexOf("hover") >= 0) {
if (j.style.backgroundHoveredColor) {f.style.backgroundColor = j.style.backgroundHoveredColor;}
if (j.style.hoveredColor) {f.style.color = j.style.hoveredColor;}
return;
}
if (f.className.indexOf("selected") >= 0) {
if (j.style.backgroundSelectedColor) {f.style.backgroundColor = j.style.backgroundSelectedColor;}
if (j.style.selectedColor) {f.style.color = j.style.selectedColor;}
return;
}
if (j.style.backgroundColor) {f.style.backgroundColor = j.style.backgroundColor;}
if (j.style.color) {f.style.color = j.style.color;}
};
this.style = {
headerBackgroundColor: "",
headerColor: "",
headerBackgroundHoveredColor: "",
headerHoveredColor: "",
headerBackgroundSelectedColor: "",
headerSelectedColor: "",
backgroundColor: "",
color: "",
backgroundHoveredColor: "",
hoveredColor: "",
backgroundSelectedColor: "",
selectedColor: ""
};
this.enabletooltips = true;
this.columngroup = null;
this.filterdelay = 800;
this.reseteverpresentrowwidgetvalue = null;
this.geteverpresentrowwidgetvalue = null;
this.createeverpresentrowwidget = null;
this.initeverpresentrowwidget = null;
this.validateeverpresentrowwidgetvalue = null;
this.destroyeverpresentrowwidget = null;
this.getcolumnproperties = function () {
return {
nullable: this.nullable,
sortable: this.sortable,
hideable: this.hideable,
hidden: this.hidden,
groupable: this.groupable,
width: this.width,
align: this.align,
editable: this.editable,
minwidth: this.minwidth,
maxwidth: this.maxwidth,
resizable: this.resizable,
datafield: this.datafield,
text: this.text,
exportable: this.exportable,
cellsalign: this.cellsalign,
pinned: this.pinned,
cellsformat: this.cellsformat,
columntype: this.columntype,
classname: this.classname,
cellclassname: this.cellclassname,
menu: this.menu
};
}, this.setproperty = function (f, g) {
if (this[f]) {
var h = this[f];
this[f] = g;
this.owner._columnPropertyChanged(this, f, g, h);
} else {
if (this[f.toLowerCase()]) {
var h = this[f.toLowerCase()];
this[f.toLowerCase()] = g;
this.owner._columnPropertyChanged(this, f.toLowerCase(), g, h);
}
}
};
this._initfields = function (g) {
if (g != null) {
var f = this.that;
if (b.jqx.hasProperty(g, "dataField")) {this.datafield = b.jqx.get(g, "dataField");}
if (b.jqx.hasProperty(g, "selectable")) {this.selectable = b.jqx.get(g, "selectable");}
if (b.jqx.hasProperty(g, "displayField")) {this.displayfield = b.jqx.get(g, "displayField");} else {this.displayfield = this.datafield;}
if (b.jqx.hasProperty(g, "enableTooltips")) {this.enabletooltips = b.jqx.get(g, "enableTooltips");}
if (b.jqx.hasProperty(g, "text")) {this.text = b.jqx.get(g, "text");} else {this.text = this.displayfield;}
if (b.jqx.hasProperty(g, "style")) {this.style = b.jqx.get(g, "style");}
if (b.jqx.hasProperty(g, "createfilterpanel")) {this.createfilterpanel = b.jqx.get(g, "createfilterpanel");}
if (b.jqx.hasProperty(g, "sortable")) {this.sortable = b.jqx.get(g, "sortable");}
if (b.jqx.hasProperty(g, "hideable")) {this.hideable = b.jqx.get(g, "hideable");}
if (b.jqx.hasProperty(g, "hidden")) {this.hidden = b.jqx.get(g, "hidden");}
if (b.jqx.hasProperty(g, "adaptivehidden")) {this.adaptivehidden = b.jqx.get(g, "adaptivehidden");}
if (b.jqx.hasProperty(g, "groupable")) {this.groupable = b.jqx.get(g, "groupable");}
if (b.jqx.hasProperty(g, "renderer")) {this.renderer = b.jqx.get(g, "renderer");}
if (b.jqx.hasProperty(g, "align")) {this.align = b.jqx.get(g, "align");}
if (b.jqx.hasProperty(g, "cellsAlign")) {this.cellsalign = b.jqx.get(g, "cellsAlign");}
if (b.jqx.hasProperty(g, "clipboard")) {this.clipboard = b.jqx.get(g, "clipboard");}
if (b.jqx.hasProperty(g, "cellsFormat")) {this.cellsformat = b.jqx.get(g, "cellsFormat");}
if (b.jqx.hasProperty(g, "width")) {this.width = b.jqx.get(g, "width");}
if (b.jqx.hasProperty(g, "minWidth")) {
this.minwidth = parseInt(b.jqx.get(g, "minWidth"));
if (isNaN(this.minwidth)) {this.minwidth = 25;}
}
if (b.jqx.hasProperty(g, "maxWidth")) {
this.maxwidth = parseInt(b.jqx.get(g, "maxWidth"));
if (isNaN(this.maxwidth)) {this.maxwidth = "auto";}
}
if (b.jqx.hasProperty(g, "cellsRenderer")) {this.cellsrenderer = b.jqx.get(g, "cellsRenderer");} else {if (g.cellsRenderer) {this.cellsrenderer = g.cellsRenderer;}}
if (b.jqx.hasProperty(g, "columnType")) {this.columntype = b.jqx.get(g, "columnType");}
if (b.jqx.hasProperty(g, "checkChange")) {this.checkchange = b.jqx.get(g, "checkChange");}
if (b.jqx.hasProperty(g, "buttonClick")) {this.buttonclick = b.jqx.get(g, "buttonClick");} else {if (g.buttonClick) {this.buttonclick = g.buttonClick;}}
if (b.jqx.hasProperty(g, "pinned")) {this.pinned = b.jqx.get(g, "pinned");}
if (b.jqx.hasProperty(g, "visibleIndex")) {this.visibleindex = b.jqx.get(g, "visibleIndex");}
if (b.jqx.hasProperty(g, "filterable")) {this.filterable = b.jqx.get(g, "filterable");}
if (b.jqx.hasProperty(g, "filter")) {this.filter = b.jqx.get(g, "filter");}
if (b.jqx.hasProperty(g, "resizable")) {this.resizable = b.jqx.get(g, "resizable");}
if (b.jqx.hasProperty(g, "editable")) {this.editable = b.jqx.get(g, "editable");}
if (b.jqx.hasProperty(g, "initEditor")) {this.initeditor = b.jqx.get(g, "initEditor");} else {if (g.initEditor) {this.initeditor = g.initEditor;}}
if (b.jqx.hasProperty(g, "createEditor")) {this.createeditor = b.jqx.get(g, "createEditor");} else {if (g.createEditor) {this.createeditor = g.createEditor;}}
if (b.jqx.hasProperty(g, "initWidget")) {this.initwidget = b.jqx.get(g, "initWidget");} else {if (g.initWidget) {this.initwidget = g.initWidget;}}
if (b.jqx.hasProperty(g, "createWidget")) {this.createwidget = b.jqx.get(g, "createWidget");} else {if (g.createWidget) {this.createwidget = g.createWidget;}}
if (b.jqx.hasProperty(g, "destroyWidget")) {this.destroywidget = b.jqx.get(g, "destroyWidget");} else {if (g.destroyWidget) {this.destroywidget = g.destroyWidget;}}
if (b.jqx.hasProperty(g, "reseteverpresentrowwidgetvalue") || b.jqx.hasFunction(g, "reseteverpresentrowwidgetvalue")) {this.reseteverpresentrowwidgetvalue = b.jqx.get(g, "reseteverpresentrowwidgetvalue");} else {if (g.resetEverPresentRowWidgetValue) {this.reseteverpresentrowwidgetvalue = g.resetEverPresentRowWidgetValue;}}
if (b.jqx.hasProperty(g, "geteverpresentrowwidgetvalue") || b.jqx.hasFunction(g, "geteverpresentrowwidgetvalue")) {this.geteverpresentrowwidgetvalue = b.jqx.get(g, "geteverpresentrowwidgetvalue");} else {if (g.getEverPresentRowWidgetValue) {this.geteverpresentrowwidgetvalue = g.getEverPresentRowWidgetValue;}}
if (b.jqx.hasProperty(g, "createeverpresentrowwidget") || b.jqx.hasFunction(g, "createeverpresentrowwidget")) {this.createeverpresentrowwidget = b.jqx.get(g, "createeverpresentrowwidget");} else {if (g.createEverPresentRowWidget) {this.createeverpresentrowwidget = g.createEverPresentRowWidget;}}
if (b.jqx.hasProperty(g, "initeverpresentrowwidget") || b.jqx.hasFunction(g, "initeverpresentrowwidget")) {this.initeverpresentrowwidget = b.jqx.get(g, "initeverpresentrowwidget");} else {if (g.initEverPresentRowWidget) {this.initeverpresentrowwidget = g.initEverPresentRowWidget;}}
if (b.jqx.hasProperty(g, "validateeverpresentrowwidgetvalue")) {this.validateeverpresentrowwidgetvalue = b.jqx.get(g, "validateeverpresentrowwidgetvalue");} else {if (g.validateEverPresentRowWidgetValue) {this.validateeverpresentrowwidgetvalue = g.validateEverPresentRowWidgetValue;}}
if (b.jqx.hasProperty(g, "destroyeverpresentrowwidget") || b.jqx.hasFunction(g, "destroyeverpresentrowwidget")) {this.destroyeverpresentrowwidget = b.jqx.get(g, "destroyeverpresentrowwidget");} else {if (g.destroyEverPresentRowWidget) {this.destroyEverPresentRowWidget = g.destroyEverPresentRowWidget;}}
if (b.jqx.hasProperty(g, "destroyEditor")) {this.destroyeditor = b.jqx.get(g, "destroyEditor");} else {if (g.destroyEditor) {this.destroyeditor = g.destroyEditor;}}
if (b.jqx.hasProperty(g, "getEditorValue")) {this.geteditorvalue = b.jqx.get(g, "getEditorValue");} else {if (g.getEditorValue) {this.geteditorvalue = g.getEditorValue;}}
if (b.jqx.hasProperty(g, "validation")) {this.validation = b.jqx.get(g, "validation");} else {if (g.validation) {this.validation = g.validation;}}
if (b.jqx.hasProperty(g, "cellBeginEdit")) {this.cellbeginedit = b.jqx.get(g, "cellBeginEdit");} else {if (g.cellBeginEdit) {this.cellbeginedit = g.cellBeginEdit;}}
if (b.jqx.hasProperty(g, "cellEndEdit")) {this.cellendedit = b.jqx.get(g, "cellEndEdit");} else {if (g.cellEndEdit) {this.cellendedit = g.cellEndEdit;}}
if (b.jqx.hasProperty(g, "className")) {this.classname = b.jqx.get(g, "className");}
if (b.jqx.hasProperty(g, "cellClassName")) {this.cellclassname = b.jqx.get(g, "cellClassName");} else {if (g.cellClassName) {this.cellclassname = g.cellClassName;}}
if (b.jqx.hasProperty(g, "menu")) {this.menu = b.jqx.get(g, "menu");}
if (b.jqx.hasProperty(g, "aggregates")) {this.aggregates = b.jqx.get(g, "aggregates");}
if (b.jqx.hasProperty(g, "aggregatesRenderer")) {this.aggregatesrenderer = b.jqx.get(g, "aggregatesRenderer");}
if (b.jqx.hasProperty(g, "createFilterWidget")) {this.createfilterwidget = b.jqx.get(g, "createFilterWidget");}
if (b.jqx.hasProperty(g, "filterType")) {this.filtertype = b.jqx.get(g, "filterType");}
if (b.jqx.hasProperty(g, "filterDelay")) {this.filterdelay = b.jqx.get(g, "filterDelay");}
if (b.jqx.hasProperty(g, "rendered")) {this.rendered = b.jqx.get(g, "rendered");}
if (b.jqx.hasProperty(g, "exportable")) {this.exportable = b.jqx.get(g, "exportable");}
if (b.jqx.hasProperty(g, "filterItems")) {this.filteritems = b.jqx.get(g, "filterItems");}
if (b.jqx.hasProperty(g, "cellValueChanging")) {this.cellvaluechanging = b.jqx.get(g, "cellValueChanging");}
if (b.jqx.hasProperty(g, "draggable")) {this.draggable = b.jqx.get(g, "draggable");}
if (b.jqx.hasProperty(g, "filterCondition")) {this.filtercondition = b.jqx.get(g, "filterCondition");}
if (b.jqx.hasProperty(g, "threeStateCheckbox")) {this.threestatecheckbox = b.jqx.get(g, "threeStateCheckbox");}
if (b.jqx.hasProperty(g, "nullable")) {this.nullable = b.jqx.get(g, "nullable");}
if (b.jqx.hasProperty(g, "columnGroup")) {this.columngroup = b.jqx.get(g, "columnGroup");}
if (!g instanceof String && !(typeof g == "string")) {
for (var h in g) {
if (!f.hasOwnProperty(h)) {
if (!f.hasOwnProperty(h.toLowerCase())) {
d.host.remove();
throw new Error("jqxGrid: Invalid property name - " + h + ".");
}
}
}
}
}
};
this._initfields(e);
return this;
}
function a(d, e) {
this.setdata = function (f) {
if (f != null) {
this.bounddata = f;
this.boundindex = f.boundindex;
this.visibleindex = f.visibleindex;
this.group = f.group;
this.parentbounddata = f.parentItem;
this.uniqueid = f.uniqueid;
this.level = f.level;
}
};
this.setdata(e);
this.parentrow = null;
this.subrows = new Array();
this.owner = d;
this.height = 25;
this.hidden = false;
this.rowdetails = null;
this.rowdetailsheight = 100;
this.rowdetailshidden = true;
this.top = -1;
this.setrowinfo = function (f) {
this.hidden = f.hidden;
this.rowdetails = f.rowdetails;
this.rowdetailsheight = f.rowdetailsheight;
this.rowdetailshidden = !f.showdetails;
this.height = f.height;
};
return this;
}
b.jqx.collection = function (d) {
this.records = new Array();
this.owner = d;
this.updating = false;
this.beginupdate = function () {this.updating = true;};
this.resumeupdate = function () {this.updating = false;};
this._raiseEvent = function (e) {};
this.clear = function () {this.records = new Array();};
this.replace = function (f, e) {
this.records[f] = e;
if (!this.updating) {this._raiseEvent({ type: "replace", element: e });}
};
this.isempty = function (e) {
if (this.records[e] == undefined) {return true;}
return false;
};
this.initialize = function (e) {
if (e < 1) {e = 1;}
this.records[e - 1] = -1;
};
this.length = function () {return this.records.length;};
this.indexOf = function (e) {return this.records.indexOf(e);};
this.add = function (e) {
if (e == null) {return false;}
this.records[this.records.length] = e;
if (!this.updating) {this._raiseEvent({ type: "add", element: e });}
return true;
};
this.insertAt = function (f, e) {
if (f == null || f == undefined) {return false;}
if (e == null) {return false;}
if (f >= 0) {
if (f < this.records.length) {
this.records.splice(f, 0, e);
if (!this.updating) {this._raiseEvent({ type: "insert", index: f, element: e });}
return true;
} else {return this.add(e);}
}
return false;
};
this.remove = function (f) {
if (f == null || f == undefined) {return false;}
var e = this.records.indexOf(f);
if (e != -1) {
this.records.splice(e, 1);
if (!this.updating) {this._raiseEvent({ type: "remove", element: f });}
return true;
}
return false;
};
this.removeAt = function (f) {
if (f == null || f == undefined) {return false;}
if (f < 0) {return false;}
if (f < this.records.length) {
var e = this.records[f];
this.records.splice(f, 1);
if (!this.updating) {this._raiseEvent({ type: "removeAt", index: f, element: e });}
return true;
}
return false;
};
return this;
};
b.jqx.dataview = function () {
this.self = this;
this.aggregates = false;
this.grid = null;
this.uniqueId = "id";
this.records = [];
this.rows = [];
this.columns = [];
this.groups = [];
this.filters = new Array();
this.updated = null;
this.update = null;
this.suspend = false;
this.pagesize = 0;
this.pagenum = 0;
this.totalrows = 0;
this.totalrecords = 0;
this.groupable = true;
this.loadedrecords = [];
this.loadedrootgroups = [];
this.loadedgroups = [];
this.loadedgroupsByKey = [];
this.virtualmode = true;
this._cachegrouppages = new Array();
this.source = null;
this.changedrecords = new Array();
this.rowschangecallback = null;
this.that = this;
this.destroy = function () {
delete this.self;
delete this.grid;
delete this.uniqueId;
delete this.records;
delete this.rows;
delete this.columns;
delete this.groups;
delete this.filters;
delete this.updated;
delete this.update;
delete this.suspend;
delete this.pagesize;
delete this.pagenum;
delete this.totalrows;
delete this.totalrecords;
delete this.groupable;
delete this.loadedrecords;
delete this.loadedrootgroups;
delete this.loadedgroups;
delete this.loadedgroupsByKey;
delete this.virtualmode;
delete this._cachegrouppages;
delete this.source;
delete this.changedrecords;
delete this.rowschangecallback;
delete this.that;
}, this.suspendupdate = function () {this.suspend = true;}, this.isupdating = function () {return this.suspend;}, this.resumeupdate = function (d) {
this.suspend = false;
if (d == undefined) {d = true;}
this.refresh(d);
}, this.getrecords = function () {return this.records;}, this.clearrecords = function () {this.recordids = new Array();};
this.databind = function (y, p) {
var w = y._source ? true : false;
var h = null;
if (this.grid) {this.aggregates = this.grid.showgroupaggregates;}
if (w) {
h = y;
y = y._source;
} else {h = new b.jqx.dataAdapter(y, { autoBind: false });}
var f = function (m) {
h.recordids = [];
h.records = new Array();
h.cachedrecords = new Array();
h.originaldata = new Array();
h._options.virtualmode = m.virtualmode;
h._options.totalrecords = m.totalrecords;
h._options.originaldata = m.originaldata;
h._options.recordids = m.recordids;
h._options.cachedrecords = new Array();
h._options.pagenum = m.pagenum;
h._options.pageable = m.pageable;
if (y.type != undefined) {h._options.type = y.type;}
if (y.formatdata != undefined) {h._options.formatData = y.formatdata;}
if (y.contenttype != undefined) {h._options.contentType = y.contenttype;}
if (y.async != undefined) {h._options.async = y.async;}
if (y.updaterow != undefined) {h._options.updaterow = y.updaterow;}
if (y.addrow != undefined) {h._options.addrow = y.addrow;}
if (y.deleterow != undefined) {h._options.deleterow = y.deleterow;}
if (m.pagesize == 0) {m.pagesize = 10;}
h._options.pagesize = m.pagesize;
};
var B = function (I) {
I.totalrecords = h.totalrecords;
if (!I.virtualmode) {
I.originaldata = h.originaldata;
I.records = h.records;
I.recordids = h.recordids;
I.cachedrecords = h.cachedrecords;
} else {
var m = { startindex: I.pagenum * I.pagesize, endindex: (I.pagenum * I.pagesize + I.pagesize) };
if (y.recordstartindex != undefined) {m.startindex = parseInt(y.recordstartindex);}
if (y.recordendindex != undefined) {m.endindex = parseInt(y.recordendindex);} else {
if (!I.grid.pageable) {
m.endindex = m.startindex + 100;
if (I.grid.autoheight) {m.endindex = m.startindex + I.totalrecords;}
}
}
if (!y.recordendindex) {
if (!I.grid.pageable) {
m.endindex = m.startindex + 100;
if (I.grid.autoheight) {m.endindex = m.startindex + I.totalrecords;}
} else {m = { startindex: I.pagenum * I.pagesize, endindex: (I.pagenum * I.pagesize + I.pagesize) };}
}
m.data = h.records;
if (I.grid.rendergridrows && I.totalrecords > 0) {
var J = 0;
y.records = I.grid.rendergridrows(m);
if (y.records.length) {J = y.records.length;}
if (y.records && !y.records[m.startindex]) {
var K = new Array();
var H = m.startindex;
b.each(y.records, function () {
K[H] = this;
H++;
J++;
});
y.records = K;
}
if (J == 0) {if (y.records) {b.each(y.records, function () {J++;});}}
if (J > 0 && J < m.endindex - m.startindex && !I.grid.groupable) {
var x = y.records[0];
for (var q = 0; q < m.endindex - m.startindex - J; q++) {
var L = {};
for (var o in x) {L[o] = "";}
if (y.records.push) {y.records.push(L);}
}
}
}
if (!y.records || I.totalrecords == 0) {y.records = new Array();}
I.originaldata = y.records;
I.records = y.records;
I.cachedrecords = y.records;
}
};
f(this);
this.source = y;
if (p !== undefined) {var k = p;}
var G = this.that;
switch (y.datatype) {
case"local":
case"array":
default:
if (y.localdata == null) {y.localdata = [];}
if (y.localdata != null) {
h.unbindBindingUpdate(G.grid.element.id);
if ((!G.grid.autobind && G.grid.isInitialized) || G.grid.autobind) {h.dataBind();}
var n = function (o) {
if (o != undefined && o != "") {
var q = h._changedrecords[0];
if (q) {
var x = new Array();
b.each(h._changedrecords, function (K) {
var H = this.index;
var I = this.record;
G.grid._updateFromAdapter = true;
switch (o) {
case"update":
var J = G.grid.getrowid(H);
if (K == h._changedrecords.length - 1) {G.grid.updaterow(J, I);} else {G.grid.updaterow(J, I, false);}
G.grid._updateFromAdapter = false;
return;
case"add":
G.grid.addrow(null, I);
G.grid._updateFromAdapter = false;
return;
case"remove":
var J = G.grid.getrowid(H);
x.push(J);
return;
}
});
if (x.length > 0) {
G.grid.deleterow(x, false);
G.grid._updateFromAdapter = false;
}
}
if (o == "update") {return;}
}
var m = G.totalrecords;
B(G, o);
if (y.localdata.notifier === null && y.localdata.name == "observableArray") {
y.localdata.notifier = function (L) {
if (this._updating) {return;}
this._updating = true;
var K = G.grid.getrowid(L.index);
switch (L.type) {
case"add":
var H = b.extend({}, L.object[L.index]);
var J = h.getid(y.id, H, L.index);
if (L.index === 0) {G.grid.addrow(J, H, "first");} else {G.grid.addrow(J, H);}
break;
case"delete":
G.grid.deleterow(K);
break;
case"update":
if (L.path && L.path.split(".").length > 1) {
var I = L.path.split(".");
G.grid.setcellvalue(L.index, I[I.length - 1], L.newValue);
} else {
var H = b.extend({}, L.object[L.index]);
G.grid.updaterow(K, H);
}
break;
}
this._updating = false;
};
}
if (o == "updateData") {
G.refresh();
G.grid._updateGridData();
} else {
if (y.recordstartindex && this.virtualmode) {G.updateview(y.recordstartindex, y.recordstartindex + G.pagesize);} else {G.refresh();}
G.update(m != G.totalrecords);
}
};
n();
h.bindBindingUpdate(G.grid.element.id, n);
}
break;
case"json":
case"jsonp":
case"xml":
case"xhtml":
case"script":
case"text":
case"csv":
case"tab":
if (y.localdata != null) {
h.unbindBindingUpdate(G.grid.element.id);
if ((!G.grid.autobind && G.grid.isInitialized) || G.grid.autobind) {h.dataBind();}
var n = function (o) {
var m = G.totalrecords;
B(G);
if (o == "updateData") {
G.refresh();
G.grid._updateGridData();
} else {
if (y.recordstartindex && G.virtualmode) {G.updateview(y.recordstartindex, y.recordstartindex + G.pagesize);} else {G.refresh();}
G.update(m != G.totalrecords);
}
};
n();
h.bindBindingUpdate(G.grid.element.id, n);
return;
}
var D = {};
var C = [];
var v = 0;
var E = {};
for (var j = 0; j < this.filters.length; j++) {
var g = this.filters[j].datafield;
var l = this.filters[j].filter;
if (!l.getfilters) {continue;}
var i = l.getfilters();
E[g + "operator"] = l.operator;
for (var A = 0; A < i.length; A++) {
i[A].datafield = g;
var u = i[A].value;
if (i[A].type == "datefilter") {
if (i[A].value && i[A].value.toLocaleString) {
var d = this.grid.getcolumn(i[A].datafield);
if (d && d.cellsformat) {
var z = this.grid.source.formatDate(i[A].value, d.cellsformat, this.grid.gridlocalization);
if (z) {E["filtervalue" + v] = z;} else {E["filtervalue" + v] = i[A].value.toLocaleString();}
} else {E["filtervalue" + v] = u.toString();}
} else {E["filtervalue" + v] = u.toString();}
} else {
E["filtervalue" + v] = u.toString();
if (i[A].data) {E["filterid" + v] = i[A].data.toString();}
if (i[A].id) {E["filterid" + v] = i[A].id.toString();}
}
E["filtercondition" + v] = i[A].condition;
E["filteroperator" + v] = i[A].operator;
E["filterdatafield" + v] = g;
var t = { label: u.toString() };
if (i[A].data) {t.value = i[A].data.toString();}
if (i[A].id) {t.value = i[A].id.toString();} else {t.value = u.toString();}
t.condition = i[A].condition;
t.operator = i[A].operator == 0 ? "and" : "or";
t.field = g;
t.type = i[A].type;
var e = false;
if (C.length > 0) {
for (var s = 0; s < C.length; s++) {
var r = C[s];
if (r.field == g) {
r.filters.push(t);
e = true;
break;
}
}
}
if (!e) {
C.push({ field: g, filters: [] });
C[C.length - 1].filters.push(t);
}
v++;
}
}
E.filterGroups = C;
E.filterscount = v;
E.groupscount = G.groups.length;
for (var j = 0; j < G.groups.length; j++) {E["group" + j] = G.groups[j];}
if (y.recordstartindex == undefined) {y.recordstartindex = 0;}
if (y.recordendindex == undefined || y.recordendindex == 0) {
if (G.grid.height && G.grid.height.toString().indexOf("%") == -1) {
y.recordendindex = parseInt(G.grid.height) / G.grid.rowsheight;
y.recordendindex += 2;
y.recordendindex = parseInt(y.recordendindex);
} else {
y.recordendindex = b(window).height() / G.grid.rowsheight;
y.recordendindex = parseInt(y.recordendindex);
}
if (this.pageable) {y.recordendindex = this.pagesize;}
}
if (this.pageable) {
y.recordstartindex = (this.pagenum) * this.pagesize;
y.recordendindex = (this.pagenum + 1) * this.pagesize;
}
b.extend(E, { sortdatafield: G.sortfield, sortorder: G.sortfielddirection, pagenum: G.pagenum, pagesize: G.grid.pagesize, recordstartindex: y.recordstartindex, recordendindex: y.recordendindex });
var F = h._options.data;
if (h._options.data) {b.extend(h._options.data, E);} else {
if (y.data) {b.extend(E, y.data);}
h._options.data = E;
}
var n = function () {
var o = b.jqx.browser.msie && b.jqx.browser.version < 9;
var q = function () {
var x = G.totalrecords;
B(G);
if (y.recordstartindex && G.virtualmode) {G.updateview(y.recordstartindex, y.recordstartindex + G.pagesize);} else {G.refresh();}
G.update(x != G.totalrecords);
};
if (o) {try {q();} catch (m) {}} else {q();}
};
h.unbindDownloadComplete(G.grid.element.id);
h.bindDownloadComplete(G.grid.element.id, n);
if ((!G.grid.autobind && G.grid.isInitialized) || G.grid.autobind) {h.dataBind();} else {if (!G.grid.isInitialized && !G.grid.autobind) {n();}}
h._options.data = F;
}
};
this.getid = function (g, e, f) {
if (b(g, e).length > 0) {return b(g, e).text();}
if (g) {
if (g.toString().length > 0) {
var d = b(e).attr(g);
if (d != null && d.toString().length > 0) {return d;}
}
}
return f;
};
this.getvaluebytype = function (g, d) {
var e = g;
if (d.type == "date") {
var f = new Date(g);
if (f.toString() == "NaN" || f.toString() == "Invalid Date") {if (b.jqx.dataFormat) {g = b.jqx.dataFormat.tryparsedate(g);} else {g = f;}} else {g = f;}
if (g == null) {g = e;}
} else {
if (d.type == "float") {
var g = parseFloat(g);
if (isNaN(g)) {g = e;}
} else {
if (d.type == "int") {
var g = parseInt(g);
if (isNaN(g)) {g = e;}
} else {
if (d.type == "bool") {
if (g != null) {if (g.toLowerCase() == "false") {g = false;} else {if (g.toLowerCase() == "true") {g = true;}}}
if (g == 1) {g = true;} else {if (g == 0) {g = false;} else {g = "";}}
}
}
}
}
return g;
};
this.setpaging = function (d) {
if (d.pageSize != undefined) {this.pagesize = d.pageSize;}
if (d.pageNum != undefined) {this.pagenum = Math.min(d.pageNum, Math.ceil(this.totalrows / this.pagesize));}
this.refresh();
};
this.getpagingdetails = function () {return { pageSize: this.pagesize, pageNum: this.pagenum, totalrows: this.totalrows };};
this._clearcaches = function () {
this.sortcache = {};
this.sortdata = null;
this.changedrecords = new Array();
this.records = new Array();
this.rows = new Array();
this.cacheddata = new Array();
this.originaldata = new Array();
this.bounditems = new Array();
this.loadedrecords = new Array();
this.loadedrootgroups = new Array();
this.loadedgroups = new Array();
this.loadedgroupsByKey = new Array();
this._cachegrouppages = new Array();
this.recordsbyid = new Array();
this.cachedrecords = new Array();
this.recordids = new Array();
};
this.addfilter = function (g, f) {
var e = -1;
for (var d = 0; d < this.filters.length; d++) {
if (this.filters[d].datafield == g) {
e = d;
break;
}
}
if (e == -1) {this.filters[this.filters.length] = { filter: f, datafield: g };} else {this.filters[e] = { filter: f, datafield: g };}
};
this.removefilter = function (e) {
for (var d = 0; d < this.filters.length; d++) {
if (this.filters[d].datafield == e) {
this.filters.splice(d, 1);
break;
}
}
};
this.getItemFromIndex = function (d) {return this.records[d];};
this.updaterow = function (d, n, l) {
var e = this.filters && this.filters.length > 0 && !this.virtualmode;
if (!e && n != undefined && d != undefined) {
n.uid = d;
if (!(n[this.source.id])) {n[this.source.id] = n.uid;}
var j = this.recordsbyid["id" + d];
var k = this.records.indexOf(j);
if (k == -1) {return false;}
this.records[k] = n;
if (this.cachedrecords) {this.cachedrecords[k] = n;}
if (l == true || l == undefined) {this.refresh();}
this.changedrecords[n.uid] = { Type: "Update", OldData: j, Data: n };
return true;
} else {
if (this.filters && this.filters.length > 0) {
var f = this.cachedrecords;
var j = null;
var k = -1;
for (var h = 0; h < f.length; h++) {
if (f[h].uid == d) {
j = f[h];
k = h;
break;
}
}
if (j) {
var m = this.that;
for (var g in n) {m.cachedrecords[k][g] = n[g];}
if (l == true || l == undefined) {this.refresh();}
return true;
}
}
}
return false;
};
this.addrow = function (h, i, d, g) {
if (i != undefined) {
if (b.isEmptyObject(i)) {
if (this.source && this.source.datafields) {
b.each(this.source.datafields, function () {
var j = "";
if (this.type == "number") {j = null;}
if (this.type == "date") {j = null;}
if (this.type == "bool" || this.type == "boolean") {j = false;}
i[this.name] = j;
});
}
}
if (!h || this.recordsbyid["id" + h]) {
i.uid = this.getid(this.source.id, i, this.totalrecords);
var e = this.recordsbyid["id" + i.uid];
while (e != null) {
var f = Math.floor(Math.random() * 10000).toString();
i.uid = f;
e = this.recordsbyid["id" + f];
}
} else {i.uid = h;}
if (!(i[this.source.id])) {if (this.source.id != undefined) {i[this.source.id] = i.uid;}}
if (d == "last") {this.records.push(i);} else {if (typeof d === "number" && isFinite(d)) {this.records.splice(d, 0, i);} else {this.records.splice(0, 0, i);}}
if (this.filters && this.filters.length > 0) {if (d == "last") {this.cachedrecords.push(i);} else {if (typeof d === "number" && isFinite(d)) {this.cachedrecords.splice(d, 0, i);} else {this.cachedrecords.splice(0, 0, i);}}}
this.totalrecords++;
if (this.virtualmode) {this.source.totalrecords = this.totalrecords;}
if (g == true || g == undefined) {this.refresh();}
this.changedrecords[i.uid] = { Type: "New", Data: i };
return true;
}
return false;
};
this.deleterow = function (j, h) {
if (j != undefined) {
var d = this.filters && this.filters.length > 0;
if (this.recordsbyid["id" + j] && !d) {
var e = this.recordsbyid["id" + j];
var k = this.records.indexOf(e);
if (this.grid && this.grid.sortable && this.grid.sortmode == "many") {
for (var g = 0; g < this.records.length; g++) {
if (this.records[g].boundindex === e.boundindex) {
k = g;
break;
}
}
}
this.changedrecords[j] = { Type: "Delete", Data: this.records[k] };
this.records.splice(k, 1);
this.totalrecords--;
if (this.virtualmode) {this.source.totalrecords = this.totalrecords;}
if (h == true || h == undefined) {this.refresh();}
return true;
} else {
if (this.filters && this.filters.length > 0) {
var f = this.cachedrecords;
var e = null;
var k = -1;
for (var g = 0; g < f.length; g++) {
if (f[g].uid == j) {
e = f[g];
k = g;
break;
}
}
if (e) {
this.cachedrecords.splice(k, 1);
if (h == true || h == undefined) {
this.totalrecords = 0;
this.records = this.cachedrecords;
this.refresh();
}
return true;
}
}
}
return false;
}
return false;
};
this.reload = function (f, d, r, g, h, u, t) {
var m = this.that;
var l = new Array();
var o = f;
var i = d;
var j = r;
var p = g;
var k = i.length;
var w = 0;
var e = 0;
var s, n;
this.columns = [];
this.bounditems = new Array();
this.loadedrecords = new Array();
this.loadedrootgroups = new Array();
this.loadedgroups = new Array();
this.loadedgroupsByKey = new Array();
this._cachegrouppages = new Array();
this.recordsbyid = {};
if (this.totalrecords == 0) {
Object.size = function (z) {
var y = 0, x;
for (x in z) {if (z.hasOwnProperty(x)) {y++;}}
return y;
};
var v = Object.size(o);
this.totalrecords = v;
b.each(this.records, function (y) {
var z = this;
var x = 0;
b.each(z, function (A, B) {m.columns[x++] = A;});
return false;
});
}
if (this.virtualmode) {
if (this.pageable) {
this.updateview();
return;
}
var u = 0;
if (!this.groupable) {
this.updateview();
return;
} else {var t = this.totalrecords;}
} else {
var u = 0;
var t = this.totalrecords;
}
if (this.groupable && this.groups.length > 0 && this.loadgrouprecords) {
var q = u;
q = this.loadgrouprecords(0, u, t, j, e, p, i, k, l);
} else {w = this.loadflatrecords(u, t, j, e, p, i, k, l);}
if (k > e) {i.splice(e, k - e);}
if (this.groups.length > 0 && this.groupable) {this.totalrows = q;} else {this.totalrows = w;}
return l;
};
this.loadflatrecords = function (u, r, h, d, p, g, j, l) {
var m = this.that;
var o = u;
var v = u;
r = Math.min(r, this.totalrecords);
var f = this.sortdata != null;
var s = this.source.id && (this.source.datatype == "local" || this.source.datatype == "array" || this.source.datatype == "");
var t = f ? this.sortdata : this.records;
for (var k = u; k < r; k++) {
var q = {};
if (!f) {
q = new Object(t[k]);
var n = q[m.uniqueId];
q.boundindex = o;
m.loadedrecords[o] = q;
if (q.uid == undefined) {q.uid = m.getid(m.source.id, q, o);}
m.recordsbyid["id" + q.uid] = t[k];
q.uniqueid = m.generatekey();
m.bounditems[this.bounditems.length] = q;
} else {
q = b.extend({}, t[k].value);
var n = q[m.uniqueId];
q.boundindex = t[k].index;
if (q.uid == undefined) {q.uid = m.getid(m.source.id, q, q.boundindex);}
m.recordsbyid["id" + q.uid] = t[k].value;
m.loadedrecords[o] = q;
q.uniqueid = m.generatekey();
m.bounditems[q.boundindex] = q;
}
if (d >= j || n != g[d][m.uniqueId] || (p && p[n])) {l[l.length] = d;}
g[d] = q;
d++;
q.visibleindex = v;
v++;
o++;
}
if (m.grid.summaryrows) {
var e = o;
b.each(m.grid.summaryrows, function () {
var i = b.extend({}, this);
i.boundindex = r++;
m.loadedrecords[e] = i;
i.uniqueid = m.generatekey();
m.bounditems[m.bounditems.length] = i;
g[d] = i;
d++;
i.visibleindex = v;
v++;
e++;
});
}
return v;
}, this.updateview = function (o, p) {
var r = this.that;
var k = this.pagesize * this.pagenum;
var n = 0;
var s = new Array();
var e = this.filters;
var j = this.updated;
var l = s.length;
if (this.pageable) {
if (this.virtualmode) {
if (!this.groupable || this.groups.length == 0) {
this.loadflatrecords(this.pagesize * this.pagenum, this.pagesize * (1 + this.pagenum), e, n, j, s, l, []);
this.totalrows = s.length;
} else {
if (this.groupable && this.groups.length > 0 && this.loadgrouprecords) {
if (this._cachegrouppages[this.pagenum + "_" + this.pagesize] != undefined) {
this.rows = this._cachegrouppages[this.pagenum + "_" + this.pagesize];
this.totalrows = this.rows.length;
return;
}
var m = this.pagesize * (1 + this.pagenum);
if (m > this.totalrecords) {m = this.totalrecords;}
this.loadgrouprecords(0, this.pagesize * this.pagenum, m, e, n, j, s, l, []);
this._cachegrouppages[this.pagenum + "_" + this.pagesize] = this.rows;
this.totalrows = this.rows.length;
return;
}
}
}
} else {
if (this.virtualmode && (!this.groupable || this.groups.length == 0)) {
var g = this.pagesize;
if (g == 0) {g = Math.min(100, this.totalrecords);}
var d = g * this.pagenum;
if (this.loadedrecords.length == 0) {d = 0;}
if (o != null && p != null) {this.loadflatrecords(o, p, e, n, j, s, l, []);} else {this.loadflatrecords(this.pagesize * this.pagenum, this.pagesize * (1 + this.pagenum), e, n, j, s, l, []);}
this.totalrows = this.loadedrecords.length;
this.rows = s;
if (s.length >= g) {return;}
}
}
if (this.groupable && this.pageable && this.groups.length > 0 && this._updategroupsinpage) {s = this._updategroupsinpage(r, e, k, n, l, this.pagesize * this.pagenum, this.pagesize * (1 + this.pagenum));} else {
for (var h = this.pagesize * this.pagenum; h < this.pagesize * (1 + this.pagenum); h++) {
var q = h < this.loadedrecords.length ? this.loadedrecords[h] : null;
if (q == null) {continue;}
if (!this.pagesize || (k >= this.pagesize * this.pagenum && k <= this.pagesize * (this.pagenum + 1))) {
s[n] = q;
n++;
}
k++;
}
}
if ((s.length == 0 || s.length < this.pagesize) && !this.pageable && this.virtualmode) {
n = s.length;
var f = s.length;
for (var h = this.pagesize * this.pagenum; h < this.pagesize * (1 + this.pagenum) - f; h++) {
var q = {};
q.boundindex = h + f;
q.visibleindex = h + f;
q.uniqueid = r.generatekey();
q.empty = true;
r.bounditems[h + f] = q;
s[n] = q;
n++;
}
}
this.rows = s;
};
this.generatekey = function () {
var d = function () {return (((1 + Math.random()) * 16) | 0);};
return ("" + d() + d() + "-" + d() + "-" + d() + "-" + d() + "-" + d() + d() + d());
};
this.reloaddata = function () {this.reload(this.records, this.rows, this.filter, this.updated, true);};
this.refresh = function (m) {
if (this.suspend) {return;}
if (m == undefined) {m = true;}
var g = this.rows.length;
var B = this.totalrows;
if (this.filters.length > 0 && !this.virtualmode) {
var q = "";
var f = this.cachedrecords.length;
var k = new Array();
this.totalrecords = 0;
var A = this.cachedrecords;
this._dataIndexToBoundIndex = new Array();
var s = this.filters.length;
if (this.source != null && this.source.filter != undefined && this.source.localdata != undefined) {
k = this.source.filter(this.filters, A, f);
if (k == undefined) {k = new Array();}
this.records = k;
} else {
if (this.source.filter == null || this.source.filter == undefined) {
for (var l = 0; l < f; l++) {
var h = A[l];
var w = undefined;
for (var v = 0; v < s; v++) {
var q = this.filters[v].filter;
var t = h[this.filters[v].datafield];
var p = q.evaluate(t);
if (this.grid.filter) {
var z = this.grid.filter(t, h, this.filters[v].datafield, q, p);
if (z !== undefined) {p = z;}
}
if (w == undefined) {w = p;} else {if (q.operator == "or") {w = w || p;} else {w = w && p;}}
}
if (w) {
k[k.length] = b.extend({ dataindex: l }, h);
this._dataIndexToBoundIndex[l] = { boundindex: k.length - 1 };
} else {this._dataIndexToBoundIndex[l] = null;}
}
this.records = k;
}
}
if (this.sortdata) {
if (this.grid && this.grid.sortmode !== "many") {
var e = this.sortfield;
if (this.sortcache[e]) {
this.sortdata = null;
var y = this.sortcache[e].direction;
this.sortcache[e] = null;
this.sortby(this.sortfield, y);
return;
}
} else {
var d = this.grid.getsortcolumns();
for (var x = 0; x < d.length; x++) {
var o = d[x];
var u = o.dataField;
this.grid.sortby(u, o.ascending, null);
}
return;
}
}
} else {
if (this.filters.length == 0 && !this.virtualmode) {
if (this.cachedrecords) {
this.totalrecords = 0;
var A = this.cachedrecords;
this.records = A;
if (this.sortdata) {
if (this.grid && this.grid.sortmode !== "many") {
var e = this.sortfield;
if (this.sortcache[e]) {
this.sortdata = null;
var y = this.sortcache[e].direction;
this.sortcache[e] = null;
this.sortby(this.sortfield, y);
return;
}
} else {
var d = this.grid.getsortcolumns();
for (var x = 0; x < d.length; x++) {
var o = d[x];
var u = o.dataField;
this.grid.sortby(u, o.ascending, null);
}
return;
}
}
}
}
}
var r = this.reload(this.records, this.rows, this.filter, this.updated, m);
this.updated = null;
if (this.rowschangecallback != null) {
var n = this.rows;
if (B != this.totalrows) {this.rowschangecallback({ type: "PagingChanged", data: this.getpagingdetails() });}
if (g != n.length) {this.rowschangecallback({ type: "RowsCountChanged", data: { previous: g, current: n.length } });}
if (r.length > 0 || g != n.length) {this.rowschangecallback({ type: "RowsChanged", data: { previous: g, current: n.length, diff: r } });}
}
};
return this;
};
})(jqxBaseFramework);