// General object. Where it all starts.
function igtbl_Object(type)
{
if (arguments.length > 0)
this.init(type);
}
igtbl_Object.prototype.init = function(type)
{
this.Type = type;
}
// Web object. The one with an HTML element attached.
igtbl_WebObject.prototype = new igtbl_Object();
igtbl_WebObject.prototype.constructor = igtbl_WebObject;
igtbl_WebObject.base = igtbl_Object.prototype;
function igtbl_WebObject(type, element, node)
{
if (arguments.length > 0)
this.init(type, element, node);
}
igtbl_WebObject.prototype.init = function(type, element, node, viewState)
{
igtbl_WebObject.base.init.apply(this, [type]);
if (element)
{
this.Id = element.id;
this.Element = element;
}
if (node)
this.Node = node;
if (viewState)
this.ViewState = viewState;
}
igtbl_WebObject.prototype.get = function(name)
{
if (this.Node)
return this.Node.getAttribute(name);
if (this.Element)
return this.Element.getAttribute(name);
return null;
}
igtbl_WebObject.prototype.set = function(name, value)
{
if (this.Node)
this.Node.setAttribute(name, value);
else if (this.Element)
this.Element.setAttribute(name, value);
if (this.ViewState)
ig_ClientState.setPropertyValue(this.ViewState, name, value);
}
// Band object
igtbl_Band.prototype = new igtbl_WebObject();
igtbl_Band.prototype.constructor = igtbl_Band;
igtbl_Band.base = igtbl_WebObject.prototype;
function igtbl_Band(grid, node, index
, bandsInitArray, colsInitArray
)
{
if (arguments.length > 0)
this.init(grid, node, index
, bandsInitArray, colsInitArray
);
}
var igtbl_ptsBand = [
"init",
function(grid, node, index
, bandsInitArray, colsInitArray
)
{
igtbl_Band.base.init.apply(this, ["band", null, node]);
this.Grid = grid;
this.Index = index;
var defaultProps = new Array("Key", "AllowAddNew", "AllowColSizing", "AllowDelete", "AllowSort", "ItemClass", "AltClass", "AllowUpdate",
"CellClickAction", "ColHeadersVisible", "ColFootersVisible", "CollapseImage", "CurrentRowImage",
"CurrentEditRowImage", "DefaultRowHeight", "EditCellClass", "Expandable", "ExpandImage",
"FooterClass", "GroupByRowClass", "GroupCount", "HeaderClass", "HeaderClickAction", "Visible",
"IsGrouped", "ExpAreaClass", "NonSelHeaderClass", "RowLabelClass", "SelGroupByRowClass", "SelHeadClass",
"SelCellClass", "RowSizing", "SelectTypeCell", "SelectTypeColumn", "SelectTypeRow", "RowSelectors",
"NullText", "RowTemplate", "ExpandEffects", "AllowColumnMoving", "ClientSortEnabled", "Indentation",
"RowLabelWidth", "DataKeyField", "HeaderHTML", "FooterHTML", "FixedHeaderIndicator", "AllowRowNumbering",
"IndentationType"
, "HasHeaderLayout", "HasFooterLayout", "GroupByColumnsHidden", "AddNewRowVisible", "AddNewRowView",
"AddNewRowStyle"
, "_optSelectRow"
, "ShowAllCondition", "ShowEmptyCondition", "ShowNonEmptyCondition",
"Filter_AllString", "Filter_EmptyString", "Filter_NonEmptyString", "ServerPassedFilters", "ApplyOnAdd", "FilterDropDownRowCount", "RowFilterMode", "FilterDropDownStyle", "FilterHighlightRowStyle"
, "CellTitleMode", "HeaderTitleMode"
, "FilterUIType", "AllowRowFiltering", "FilterRowView", "FilterEvaluationTrigger", "FilterRowStyle", "FilterOperandDropDownStyle", "FilterOperandItemStyle", "FilterOperandItemHoverStyle", "FilterOperandButtonStyle"
, "FilterOperandStrings"
, "SortingAlgorithm"
);
this.VisibleColumnsCount = 0;
this.Columns = new Array();
var bandArray;
bandArray = bandsInitArray[index];
var bandCount = 0;
if (bandArray)
{
bandCount = bandsInitArray.length;
for (var i = 0; i < bandArray.length; i++)
this[defaultProps[i]] = bandArray[i];
if (this.RowTemplate != "")
this.ExpandEffects = new igtbl_expandEffects(this.ExpandEffects);
if (this.HeaderHTML != "")
this.HeaderHTML = unescape(this.HeaderHTML);
if (this.FooterHTML != "")
this.FooterHTML = unescape(this.FooterHTML);
}
else
bandCount = this.Node.parentNode.selectNodes("Band").length;
var colsArray = colsInitArray[index];
if (!node)
{
for (var i = 0; i < colsArray.length; i++)
{
this.Columns[i] = new igtbl_Column(null, this, i
, -1, colsArray[i]
);
if (!this.Columns[i].Hidden)
this.VisibleColumnsCount++;
if (this.Columns[i].getSelClass() != this.getSelClass())
this._selClassDiffer = true;
}
}
else
{
this.Columns.Node = this.Node.selectSingleNode("Columns");
var columNodes = this.Columns.Node.selectNodes("Column");
var nodeIndex = 0;
for (var i = 0; i < columNodes.length; i++)
{
this.Columns[i] = new igtbl_Column(columNodes[i], this, i, nodeIndex
, colsArray[i]
);
if (!this.Columns[i].Hidden && this.Columns[i].hasCells())
this.VisibleColumnsCount++;
if (!colsArray[i][33])
nodeIndex++;
if (this.Columns[i].getSelClass() != this.getSelClass())
this._selClassDiffer = true;
}
}
igtbl_dispose(defaultProps);
if (node)
{
this.ColumnsOrder = "";
for (var i = 0; i < this.Columns.length; i++)
this.ColumnsOrder += this.Columns[i].Key + (i < this.Columns.length - 1 ? ";" : "");
}
this._filterPanels = new Object();
if (this.ServerPassedFilters[0])
{
for (var itr = 0; itr < this.ServerPassedFilters.length; itr += 2)
{
var filterPanel = this._filterPanels[this.ServerPassedFilters[itr]];
var filterSettingsOpCode = this.ServerPassedFilters[itr + 1][0];
var filterSettingsValue = this.ServerPassedFilters[itr + 1][1];
var colIndex = this.ServerPassedFilters[itr].split("_");
colIndex = colIndex[colIndex.length - 1];
if (!filterPanel)
{
var filteredColumn = this.Columns[colIndex];
filterPanel = this._filterPanels[this.ServerPassedFilters[itr]] = new igtbl_FilterDropDown(filteredColumn);
}
filterPanel.setFilter(filterSettingsOpCode, filterSettingsValue, true);
}
}
if (this.AllowAddNew == 1)
{
if (this.Index == 0)
this.curTable = grid.Element;
if (grid.AddNewBoxVisible)
{
var addNew = igtbl_getElementById(grid.Id + "_addBox");
if (grid.AddNewBoxView == 0)
this.addNewElem = addNew.childNodes[0].rows[0].cells[1].childNodes[0].rows[this.Index].cells[this.Index];
else
this.addNewElem = addNew.childNodes[0].rows[0].cells[1].childNodes[0].rows[0].cells[this.Index * 2];
}
}
this.SortedColumns = new Array();
var rs = this.getRowSelectors();
if (bandCount == 1)
{
if (rs == 2)
this.firstActiveCell = 0;
else
this.firstActiveCell = 1;
}
else
{
if (rs == 2)
this.firstActiveCell = 1;
else
this.firstActiveCell = 2;
}
this._sqlWhere = "";
this.SortImplementation = null;
},
"_alignColumns",
function()
{
if (this.HasHeaderLayout)
{
var drsEls = igtbl_getDocumentElement(this.Grid.Id + "_drs");
if (drsEls)
{
var master = drsEls[0].firstChild.firstChild;
if (master.tagName != "COLGROUP")
{
return;
}
for (var d = 1; d < drsEls.length; d++)
{
var colGroup = drsEls[d].firstChild.firstChild;
if (colGroup.tagName != "COLGROUP")
{
continue;
}
for (var c = 0; c < colGroup.childNodes.length; c++)
{
colGroup.childNodes[c].width = master.childNodes[c].width;
}
}
}
}
},
"getSelectTypeRow",
function()
{
var res = this.Grid.SelectTypeRow;
if (this.SelectTypeRow != 0)
res = this.SelectTypeRow;
return res;
},
"getSelectTypeCell",
function()
{
var res = this.Grid.SelectTypeCell;
if (this.SelectTypeCell != 0)
res = this.SelectTypeCell;
return res;
},
"getSelectTypeColumn",
function()
{
var res = this.Grid.SelectTypeColumn;
if (this.SelectTypeColumn != 0)
res = this.SelectTypeColumn;
return res;
},
"getColumnFromKey",
function(key)
{
var column = null;
for (var i = 0; i < this.Columns.length; i++)
if (this.Columns[i].Key == key)
{
column = this.Columns[i];
break;