📄 extenddbgrid.htc
字号:
try{
//debugger;
intCurRecordCountNumber = getCurRecordsCount();//得到返回记录数
//////////////////////////////////
try{
intStartIdx = parseInt(__objGlobalCommonInst.__startIdx);
intRecordLimit = parseInt(__objGlobalCommonInst.__recordLimit);
intRecordCount = parseInt(__objGlobalCommonInst.__recordCount);
if((intStartIdx + intRecordLimit) >= intRecordCount){
oPageSize = intRecordCount;
booleanShowDataInOnePage = true;
}else{
oPageSize = 20;
booleanShowDataInOnePage = false;
}
}catch(e){}
////////////////////////////////////////////////
oControl.curPage.value = 1;
curPage = 1;
//debugger;
if(!objXML.selectSingleNode("//r")){
oControl.pageSize.value = 0;
oControl.startRecordIndex.innerText = 0;
oControl.endRecordIndex.innerText = 0;
oControl.recordCount.value = 0;
oControl.pageCount.innerText = 0;
}else if(intCurRecordCountNumber < oPageSize){
oControl.pageSize.value = intCurRecordCountNumber;
oControl.startRecordIndex.innerText = 0;
oControl.endRecordIndex.innerText = intCurRecordCountNumber;
oControl.recordCount.value = intCurRecordCountNumber;
oControl.pageCount.innerText = 1;
}else{
oControl.pageSize.value = oPageSize;
oControl.startRecordIndex.innerText = 1;
oControl.endRecordIndex.innerText = oPageSize;
oControl.recordCount.value = __objGlobalCommonInst.__recordCount;
oControl.pageCount.innerText = getPageNumber();
}
}catch(e){
alert("Error");
}
//////////
//getRows();
if(oDataTable){//...
fillInTable();
//updateData();
}
}else{
oDataXML = null;
}
}
function getTableRow(){
return vTableRow;
}
function putTableRow(argRow){
vTableRow = parseInt(argRow);
}
function getTableCol(){
return vTableCol;
}
function putTableCol(argCol){
vTableCol = parseInt(argCol);
}
function getTitleXML(){//设置标题的DOMDocument object
return oTitleXML;
}
function putTitleXML(argXML){
//alert("title");
initGlobalCommon();
clear();
var oTitleFragement = inputXML(argXML);
if(oTitleFragement)
oTitleXML = oTitleFragement;
else
oTitleXML = null;
}
function inputXML(argSource){ //生成XML DOM对象
if(!__objGlobalCommonInst) initGlobalCommon();
if(typeof(argSource) == "string"){//处理XML数据岛
if((!(argSource.search(/\./) != -1 && argSource.search(/\</) == -1)) && (!(argSource.search(/\</) != -1))){
try{
argSource = eval(window.document.all(argSource));
}catch(e){
}
}
}
if(!__objGlobalCommonInst){
window.__objGlobalCommonInst = window.dialogArguments.__objGlobalCommonInst;
}
return __objGlobalCommonInst.inputXML(argSource);
}
function createSplitBar(argParent){ //创建用来调整列宽的Span
objSplitBar = element.document.createElement("<span class='phms_grid_split'></span>");
objSplitBar.innerText = " ";
with(objSplitBar){
onmousedown = splitStart; //起始
onmouseup = splitEnd; //结束
}
argParent.appendChild(objSplitBar);
}
function splitStart(){ // 拖动表头开始
window.event.cancelBubble = true;
if(oEditor && oEditor.style.display != "none") return;
if (allowResizeModle.toString() == "false") return ;
vMouseStart = window.event.clientX;
objSplitBar = window.event.srcElement; // 准备活动的 splitbar
var oSplitLine = element.document.createElement("<span class='phms_grid_splitLine'></span>");//用来调整表头的span
oSplitLine = objSplitBar.appendChild(oSplitLine);
oSplitLine.style.pixelHeight = vHeight;
objSplitBar.setCapture(true); //开始鼠标捕获
objSplitBar.attachEvent("onmousemove",split); // 绑定 mousemove 事件
}
function split(){ //在 split bar' onmousemove 过程中执行
objSplitBar.children(0).style.left = window.event.clientX - vMouseStart + 4; // split line 的移动
}
function splitEnd(){// 拖动表头结束
if (allowResizeModle.toString() == "false") return ;
if(objSplitBar == null) return;
var oCurTitleDiv = objSplitBar.parentElement.parentElement.previousSibling.children(0);// 当前点击的div
objSplitBar.releaseCapture(); //解除鼠标捕获
objSplitBar.detachEvent("onmousemove",split); //解除mousemove事件的绑定
if(objSplitBar.children(0))
objSplitBar.children(0).removeNode(true); //移除split line
objSplitBar = null;
vMoveLen = window.event.clientX - vMouseStart; //移动的距离
vCellIndex = oCurTitleDiv.parentNode.cellIndex; //当前点击 DIV 所在 TD 的索引号
if(vMoveLen!=0){
oCurTitleDiv.style.pixelWidth = oCurTitleDiv.offsetWidth + vMoveLen;
if(oCurTitleDiv.offsetWidth < oCurTitleDiv.MinWidth - 4) //取最小宽度
oCurTitleDiv.style.pixelWidth = oCurTitleDiv.MinWidth - 4;
if(oCurTitleDiv.offsetWidth > oCurTitleDiv.MaxWidth - 4) //取最大宽度
oCurTitleDiv.style.pixelWidth = oCurTitleDiv.MaxWidth - 4;
if(oTBodyTable && oTBodyTable.rows(0)!=null)
oTBodyTable.rows(0).cells(vCellIndex).childNodes(0).style.pixelWidth = oCurTitleDiv.style.pixelWidth;
}
vMouseStart = null;
oCurTitleDiv = null;
//adjustGridWidth(1); //调整title body table三者宽度
evtOnDrag.fire(); //激发拖动事件
}
function adjustBodyWidth(){ //调整三部分宽度,加上偏移量,并产生校调晃动
if(oTitle==null || oTBody==null) return;
if(hasTitle.toString() == "true") oTBody.style.pixelWidth = oTBodyTable.offsetWidth + 1;
else oTBody.style.pixelWidth = vWidth - 16; //如果没有表头就不能根据data table来确定data div的宽度
oTitle.style.pixelWidth = oTBodyTable.offsetWidth + 1;
}
function selectScrollTrack(){ //跟随鼠标滚动选择
var objSrc = window.event.srcElement;
for(var i = 0; i < 3; i++){
if(objSrc.tagName.toLowerCase() == "tr") break;
objSrc = objSrc.parentElement;
}
if(i == 3) return;
if(objSrc.rowIndex == 2) return;
selected(objSrc,true); //选中当前行
objScrollTrack = objSrc;
}
function cancelSelectScrollTrack(){ //取消鼠标跟随中的前次选择
if(objScrollTrack) selected(objScrollTrack,false); //取消前次选中
}
function clickTable(){//点击DBGrid组件cell时处理事件
//
//debugger;
var oSrc,i;
var vRowTemp;
var n;
var objParentTR;
var boolInArr = false;
if(funVerifyInputWhenBlur() == -1){
return(-1);
}
selectTable(false); //取消前次的table选择
oSrc = window.event.srcElement;
if(oSrc.tagName == "INPUT" && oSrc.type == "checkbox"){
objParentTR = oSrc;
for(var i=0;i < 4;i++){
if(objParentTR.tagName == "TR"){
break;
}else{
objParentTR = objParentTR.parentElement;
}
}
if(i==4) return;//没有找到相应的行
if(oSrc.checked == true){//如果checkBox的状态为选中
n = arrCheckedRow.length;
for(var i = 0; i < n; i++){//判断该checkBox所在行的__rowid是否已经被加到了arrCheckRow数组中
if(arrCheckedRow[i] == objParentTR.__rowid){
boolInArr = true;
break;
}//End of if
}//End of for
//alert("true add " + boolInArr);
if(!boolInArr)//没有加进去
arrCheckedRow.push(objParentTR.__rowid);
}else{//如果checkBox的状态为未选中
n = arrCheckedRow.length;
for(var i = 0; i < n; i++){
if(arrCheckedRow[i] == objParentTR.__rowid){//将该行的__rowid从arrcheckRow数组中删除
boolInArr = true;
arrCheckedRow.splice(i,1);
break;
}//End of if
}//End of for
}
}//End of if
for(i = 0; i < 2; i++){ //取得点击的td对象
if(oSrc.tagName.toLowerCase() == "td") break;
oSrc = oSrc.parentElement;
}
if(i == 2) return; //说明没有找到td元素,返回
vTableRow = oSrc.parentElement.rowIndex;//行
vTableCol = oSrc.cellIndex;//列
//alert("tableRow=" + tableRow + "\ntableCol=" + tableCol);
if(vSelectionMode == "row" && vTableCol < 0) vTableCol = 1;
selectTable(true); //选择当前点击的cell或者row
showRC();
evtClickCell.fire();
//window.status = "所有选中的checkBox数量为:" + arrCheckedRow.length;
}
function showRC(){//显示当前cell的行列坐标
var r;
var c;
//
if(hasController=="true" && oControl!=null){
oControl.curRowCaption.style.visibility = "visible";
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -