|
/******************* VERSION 2.002 29-10-2005 *******************/
var SDXCtrlSelect=false;
var SDXShiftSelect=false;
var SDXActiveGrid=null;
function SDXGrid(sName,sDivName,sHeader)
{
this.DataSetName = null;
this.DataSetTableName = null ;
this.DataSetNamespace = null ;
this.Browser = new Browser() ;
this.Name=sName;
this.HTMLID = this.Name + "_SDXGrid" ;
this.EditTemplateHTMLID = this.Name + "_SDXGrid_EditTemplate" ;
this.DummyDivHTMLID = this.Name + "_SDXGrid_DummyDiv" ;
this.aSortImage=new Array('DownArrow.gif','UpArrow.gif');
this.DivName=sDivName;
this.Header=sHeader;
this.Styles = new SDX_Styles() ;
this.Height=null;
this.Width=null;
this.ResourcePath = "SDXGrid/";
this.TableClass=null;
this.AllowEditTemplate = false;
this.AllowEdit = true;
this.AllowDelete = true;
this.AllowAdd = true;
this.AllowSearch = true;
this.AllowGroupBy = true;
this.AllowResize = true;
this.AllowPaging = true;
this.AllowSorting = true;
this.AlternateRowTurn = true ; // This is for alternating item style in row.js
this.VisibleColumnCount=0;
this.RowLimit=5;
this.LastSortFieldIndex="";
this.Initialize = Initialize
this.Activate = Activate
this.DeActivate = DeActivate
this.Languages = new SDX_Languages(this); // TODO: IT DOES NOT START
this.GroupByDrager = new SDX_GroupByDrager(this);
this.Datas = new SDX_Datas(this);
this.Tables = new SDX_Tables(this);
this.Table = Table;
sdxFields.RootObject = this ;
this.Fields = sdxFields ;
this.Columns = new SDX_Columns(this);
this.Rows = new SDX_Rows(this);
this.GroupBy = new SDX_GroupBy(this);
this.Events = new SDX_Events(this);
this.GeneralFunctions = new SDX_GeneralFunctions(this);
this.GetEvalObjectString = GetEvalObjectString
this.GetRowMainArrayIndex = GetRowMainArrayIndex;
function GetRowMainArrayIndex(_RowIndex)
{
for(var i=0;i<this.Rows.Rows.length;i++)
if(this.Rows.Rows[i].RowIndex == _RowIndex)
return i;
}
function GetEvalObjectString()
{
return this.Name ;
}
function Table()
{
return document.getElementById(this.Name + "_SDXGrid");
}
function Browser()
{
var ua, s, i;
this.isIE = false;
this.isNS = false;
this.version = null;
ua = navigator.userAgent;
s = "MSIE";
if ((i = ua.indexOf(s)) >= 0) {
this.isIE = true;
this.version = parseFloat(ua.substr(i + s.length));
return;
}
s = "Netscape6/";
if ((i = ua.indexOf(s)) >= 0) {
this.isNS = true;
this.version = parseFloat(ua.substr(i + s.length));
return;
}
// Treat any other "Gecko" browser as NS 6.1.
s = "Gecko";
if ((i = ua.indexOf(s)) >= 0) {
this.isNS = true;
this.version = 6.1;
return;
}
}
// INITILIAZE GRID
function Initialize()
{
if(this.Rows.EditedCell!=null)
this.Rows.EditedCell.NormalMode()
this.GroupByDrager.ClearGroupBy()
this.Rows.ClearSelectedRows()
this.Rows.Initialize()
this.Fields.Initialize();
this.GroupBy.Rows=new Array();
this.GroupBy.AllRows=new Array();
this.GroupBy.Initialize();
this.Events.Initialize();
var sInputRow1="<tr><td class=\"sdxRow2\"> </td>"
var sInputRow2="<tr><td class=\"sdxRow1\"><input type=button value=\"Add Record\" class=spButtons onclick=\"" + this.Name + ".AddRecord()\"></td>"
for(nX in this.Columns.Columns)
{
if(this.Columns.Columns[nX].Visible==true && this.GroupBy.IsGroupByColumn(nX)==false)
{
// sInputRow1+="<td class=\"sdxRow2\">" + this.Columns.Columns[nX].HeaderName + "</td>";
// sInputRow2+="<td class=\"sdxRow1\">" + this.Columns.Columns[nX].GetEditText(this.Name + "_SDXGrid_AddInput_" + nX) + "</td>";
}
}
sInputRow1+="</tr>"
sInputRow2+="</tr>"
document.getElementById(this.DivName).innerHTML="<table id=\"" + this.Name + "_SDXGrid" + "\" bordercolor='silver' cellspacing=0 cellpadding=3 width=100% border=1 onmousedown=\"" + this.Name + ".Activate()\">" +
(this.AllowGroupBy==true?"<tr><td id='SDX_" + this.Name + "_GroupByDrager'>" + this.GroupByDrager.HTMLOutPuts() + "</td></tr>":"") +
"<tr><td cellspacing=0 cellpadding=0 id='SDX_" + this.Name + "_GroupBy'>" + this.GroupBy.HTMLOutPut + "</td></tr>" +
"</table><div id='" + this.DummyDivHTMLID + "'></div>"
}
// ACTIVATE GRID
function Activate()
{
if(SDXActiveGrid!=null && SDXActiveGrid!=this)
SDXActiveGrid.DeActivate()
document.getElementById(this.Name + "_SDXGrid").style.borderColor='#004080'
SDXActiveGrid=this;
}
// DEACTIVATE GRID
function DeActivate()
{
if(this.Rows.EditedCell!=null)
this.Rows.EditedCell.NormalMode()
document.getElementById(this.Name + "_SDXGrid").style.borderColor='silver'
}
// INSERT DATA
// function InsertData(_Data)
// {
// this.Rows.InsertRow(this.Rows.length, 0, _Data);
// return this.Rows[this.Rows.length -1];
// }
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.