⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dbgrid.js

📁 本系统的使用可以将工作的部分流程使用计算机的办公自动化处理
💻 JS
字号:
var PreRowObj="";
var bDescending=false;
var iCellIndex;
var iRowIndex=0;

//滚动信息
function SynScroll()
{
  HeaderSpan.scrollLeft = event.srcElement.scrollLeft;
}

//选中信息
function selectThis(theRowObj)
{
	if (PreRowObj!="")
   	ListTable.rows(PreRowObj).className="";
 	theRowObj.className="selectColor";
 	PreRowObj=theRowObj.id;

 	return theRowObj;

}


//点击鼠标右键
function ContextMenu()
{


}

function initScrollTable(oElement)
{
	var oTable=document.getElementById("ListTable");
	if (oTable==null)
		return;
	if (oTable.rows.length>0)
	{
		resizeScrollTable(oElement);
		oElement.firstChild.syncTo = oElement.lastChild.uniqueID;
		oElement.firstChild.syncDirection = "horizontal";
		oElement.attachEvent("onresize", function () {
			resizeScrollTable(oElement);
		});
	}
	if (sortColumnName!="")
	{
		var oArrow = document.createElement("SPAN");
		oArrow.className = "arrow";
		var tn;
		if (sortType==null || sortType=="")
			return;
		else if (sortType=="asc")
			tn = document.createTextNode("5");
		else
			tn = document.createTextNode("6");
		oArrow.appendChild(tn);
		document.getElementById(sortColumnName).appendChild(oArrow);
	}
}

function resizeScrollTable(oElement)
{
	if (document.getElementById("NavArea")==null)
		oElement.style.height=document.body.clientHeight;
	else
		oElement.style.height=document.body.clientHeight-36;
	var head = oElement.firstChild.firstChild;
	var headTable = head.firstChild;
	var body = oElement.lastChild;
	var bodyTable = body.firstChild.firstChild;

	body.style.height = Math.max(0, oElement.clientHeight - head.offsetHeight);

	var scrollBarWidth = body.offsetWidth - body.clientWidth;

	// set width of the table in the head
	headTable.style.width = Math.max(0, Math.max(bodyTable.offsetWidth + scrollBarWidth, oElement.clientWidth));

	// go through each cell in the head and resize
	var headCells = headTable.rows[0].cells;
	var bodyCells = bodyTable.rows[0].cells;


	for (var i = 0; i < bodyCells.length; i++)
	{       /*
		if (bodyCells[i].style.display=="none")
			;//continue;

		if (bodyCells[i].offsetWidth<headCells[i].offsetWidth)
			bodyCells[i].style.width=headCells[i].offsetWidth-i+1;
		else
			headCells[i].style.width = bodyCells[i].offsetWidth;
		*/
		headCells[i].style.width = Math.max(headCells[i].offsetWidth,bodyCells[i].offsetWidth);
	}
	ResizeAll();
}

///////////////////////////////
//
//排序
//
//////////////////////////////


function sortByThis()
{
  if (iCellIndex==null)
  	iCellIndex=event.srcElement.cellsIndex;
  if (iCellIndex==event.srcElement.cellsIndex)
  	bDescending=!bDescending;
  else
  	bDescending=false;

  iCellIndex=event.srcElement.cellsIndex;

}


///////////////////////////////////////////
//
//排序结束
//
/////////////////////////////////////////////////

function changeRow()
{

/*	var theRow;
	if (event.keyCode==40) //下箭头
	 {
		 	if (PreRowObj==null || PreRowObj=="")
		 		iRowIndex=0;
		 	else
		 	{
		 		if (iRowIndex==ListTable.rows.length-1)
		 			 return false;
		 		iRowIndex=ListTable.rows(PreRowObj).rowIndex+1;
		 	}

	 }

	 if (event.keyCode==38) //上箭头
	 {
		  if (PreRowObj==null || PreRowObj=="")
		 		iRowIndex=0;
		 	else
		 	{
		 		if (iRowIndex==0)
		 			return false;
		 		iRowIndex=ListTable.rows(PreRowObj).rowIndex-1;
		 	}

	 }

	 theRow=ListTable.rows(iRowIndex);
	 selectThis(theRow);
	 */
}


//document.onselectstart=function(){return false;};
document.onkeydown=changeRow;
//document.oncontextmenu=function(){return false;};
window.onresize=function()
{
	var testElement = document.getElementById("ScrollArea");
	if (testElement!=null)
	  initScrollTable(testElement);
}
window.attachEvent("onload", function () {
	var testElement = document.getElementById("ScrollArea");
	if (testElement!=null)
	  initScrollTable(testElement);
});


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -