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

📄 listsheet.htc

📁 这是一个使用DHTML技术显示的功能
💻 HTC
📖 第 1 页 / 共 5 页
字号:
				'set display based on recordcount
				if m_nRecordcount = 0 then
					'if no records then don't show any page controls
					m_elRecordcountDisplay.style.display = "none"
					m_elPageDisplay.style.display = "none"
					m_elPageControlsDisplay.style.display = "none"
				elseif m_nPageCount = 1 then
					'if one page then only show recordcount
					if m_nRecordcount = MAX_RECORD_COUNT then
						m_elRecordcountDisplay.style.display = "none"
					else
						m_elRecordcountDisplay.style.display = "block"
					end if
					m_elPageDisplay.style.display = "none"
					m_elPageControlsDisplay.style.display = "none"
				elseif m_nRecordcount = MAX_RECORD_COUNT then
					'if unknown size then show all but recordcount
					m_elRecordcountDisplay.style.display = "none"
					m_elPageDisplay.style.display = "block"
					m_elPageControlsDisplay.style.display = "block"
				else
					'show recordcount, page display and page controls
					m_elRecordcountDisplay.style.display = "block"
					m_elPageDisplay.style.display = "block"
					m_elPageControlsDisplay.style.display = "block"
				end if
				'set initial button state based on current page
				if m_nCurPage = m_nPageCount then
					'on last page
					m_elFirstPageBtn.disabled = false
					m_elBackPageBtn.disabled = false
					m_elNextPageBtn.disabled = true
					m_elLastPageBtn.disabled = true
				elseif m_nCurPage = 1 then
					'on first page
					m_elFirstPageBtn.disabled = true
					m_elBackPageBtn.disabled = true
					m_elNextPageBtn.disabled = false
					if m_nRecordcount = MAX_RECORD_COUNT then
						m_elLastPageBtn.disabled = true
					else
						m_elLastPageBtn.disabled = false
					end if
				else
					'not on first or last page
					m_elFirstPageBtn.disabled = false
					m_elBackPageBtn.disabled = false
					m_elNextPageBtn.disabled = false
					if m_nRecordcount = MAX_RECORD_COUNT then
						m_elLastPageBtn.disabled = true
					else
						m_elLastPageBtn.disabled = false
					end if
				end if
			end if
		end sub

		sub ShowEmptyPrompt()
			HideWaitDisplay()
			if m_bMultiSelect and m_bSelectionButtons then m_elSelControls.style.display = "none"
			m_elRecordcountDisplay.style.display = "none"
			m_elPageDisplay.style.display = "none"
			m_elPageControlsDisplay.style.display = "none"
			m_elMasterTable.style.display = "none"
			if m_bEmptyPrompt then
				m_elEmptyTable.style.display = "block"
			else
				m_elEmptyTable.style.display = "none"
			end if
		end sub

		sub ShowMasterTable()
			if not m_bPageControls then
				m_elRecordcountDisplay.style.display = "none"
				m_elPageDisplay.style.display = "none"
				m_elPageControlsDisplay.style.display = "none"
			end if
			if m_bMultiSelect and m_bSelectionButtons then m_elSelControls.style.display = "block"
			m_elEmptyTable.style.display = "none"
			m_elMasterTable.style.display = "block"
			if CLng(m_nCurPage) = 1 and CLng(m_xmlDataDoc.childNodes.length) < CLng(m_nPageSize) then setRecordcount(m_xmlDataDoc.childNodes.length)
		end sub

		function elGetSubObject()
			dim elDetailTable, xmlMetaCol, elHeadRow, elDetailDataRow, sLabelWidth, sDataWidth, _
				sColID, elCell, elSpan, elDiv, xmlColumns, sWidth, elSpanTemp, elNoBRTemp

			set elSpanTemp = element.document.createElement("SPAN")
			set elNoBRTemp = element.document.createElement("NOBR")

			set xmlColumns = m_xmlMetaSubColumns.selectNodes("column[@hide $ine$ 'yes' or $not$ @hide]")

			set elDetailTable = element.document.createElement("TABLE")
			with elDetailTable
				.id = "objectTable"
				.datafld = "record"
				.className = "lsTableStyle"
				.cellPadding = 0
				.cellSpacing = 0
			end with

			if m_bSubEditSheet then
				'EditSheet style: 2 columns, labels to left and values to the right
				sLabelWidth = m_xmlMetaSubColumns.getAttribute("labelwidth")
				if sLabelWidth = "0" or sLabelWidth = "" or isNull(sLabelWidth) then sLabelWidth = 30
				sDataWidth = m_xmlMetaSubColumns.getAttribute("datawidth")
				if sDataWidth = "0" or sDataWidth = "" or isNull(sDataWidth) then sDataWidth = 50
				for each xmlMetaCol in xmlColumns
					sColID = xmlMetaCol.getAttribute("id")

					set elDetailDataRow = elDetailTable.insertRow()
					with elDetailDataRow
						.style.margin = "0"
						.setAttribute "name", "subtable"
					end with

					' create header cell
					set elCell = elDetailDataRow.appendChild(element.document.createElement("TH"))
					with elCell
						.className = "lsCell lsNoSort"
						.nowrap = true
						.width = sLabelWidth & "%"
						.title = xmlMetaCol.text
					end with
					set elCell = elCell.appendChild(elNoBRTemp.cloneNode(true))
					elCell.innerHTML = xmlMetaCol.text

					' create detail cell
					set elCell = elDetailDataRow.appendChild(element.document.createElement("TD"))
					with elCell
						.className = "lsCell lsObjectCell"
						.width = sDataWidth & "%"
						.nowrap = true
					end with
					set elSpan = elCell.appendChild(elNoBRTemp.cloneNode(true))
					set elSpan = elSpan.appendChild(elSpanTemp.cloneNode(true))
					if xmlMetaCol.getAttribute("format") = "select" then
						elSpan.setAttribute "datafld", sColID & "_displayvalue"
					else
						elSpan.setAttribute "datafld", sColID
					end if
				next
			else
				'ListSheet style: one column for each field, headings in first row
				set elHeadRow = elDetailTable.createTHead()
				set elHeadRow = elHeadRow.insertRow()
				elHeadRow.setAttribute "name", "subtable"

				set elDetailDataRow = elDetailTable.insertRow()
				elDetailDataRow.setAttribute "name", "subtable"

				for each xmlMetaCol in xmlColumns
					sWidth = xmlMetaCol.getAttribute("width")
					if isNull(sWidth) or not isNumeric(sWidth) or sWidth = "" then sWidth = CInt(80/xmlColumns.length)
					if CInt(sWidth) <= 0 then sWidth = CInt(80/xmlColumns.length)
					sColID = xmlMetaCol.getAttribute("id")

					' create header cell
					set elCell = elHeadRow.appendChild(element.document.createElement("TH"))
					with elCell
						.className = "lsCell lsNoSort"
						.nowrap = true
						.width = sWidth & "%"
						.title = xmlMetaCol.text
					end with
					set elCell = elCell.appendChild(elNoBRTemp.cloneNode(true))
					elCell.innerHTML = xmlMetaCol.text

					' create detail cell
					set elCell = elDetailDataRow.insertCell()
					with elCell
						.className = "lsCell lsObjectCell"
						.width = sWidth & "%"
						.nowrap = true
					end with
					set elSpan = elCell.appendChild(elNoBRTemp.cloneNode(true))
					set elSpan = elSpan.appendChild(elSpanTemp.cloneNode(true))
					if xmlMetaCol.getAttribute("format") = "select" then
						elSpan.setAttribute "datafld", sColID & "_displayvalue"
					else
						elSpan.setAttribute "datafld", sColID
					end if
				next
			end if
			set elGetSubObject = elDetailTable
		end function

		sub PassEvent(evtID, xmlNode, nRecordNumber, sType)
			dim evt
			set evt = createEventObject()
			if not isNull(xmlNode) then
				evt.setAttribute "XMLrecord", xmlNode
			end if
			if not isNull(nRecordNumber) then
				evt.setAttribute "recordNumber", nRecordNumber
			end if
			evt.type = sType
			evtID.fire(evt)
		end sub

		sub CaptureMouse()
			if m_bLoading then exit sub
			dim elCells, nCell
			m_nTotalWidth = 0
			set elCells = m_elHeadTable.rows(0).cells
			for nCell = 0 to elCells.length - 1 step 2
				m_nTotalWidth = m_nTotalWidth + elCells(nCell).clientWidth
			next
			'remember mouse X position
			m_mx = window.event.x
			'remember tab element, set mouse capture and add handlers
			set m_elDragTab = window.event.srcElement
			m_elDragTab.setCapture()
			m_elDragTab.onmousemove = GetRef("ResizeColumn")
			m_elDragTab.onmouseup = GetRef("ReleaseMouse")
			'remember columns to left and right of tab
			set m_elLeftCol = m_elDragTab.previousSibling
			set m_elRightCol = m_elDragTab.nextSibling
			'remember original combined width
			m_nLeftWidth = m_elLeftCol.clientwidth
			m_nRightWidth = m_elRightCol.clientwidth
			m_nCombWidth = m_nLeftWidth + m_nRightWidth
		end sub

		sub ResizeColumn()
			dim dx
			'get delta in mouse X position
			dx = window.event.x - m_mx
			'don't move if adjacent cell width will be zero after the move
			if m_nLeftWidth + dx > 0 and m_nRightWidth - dx > 0 then
				'adjust adjacent columns by delta X
				m_elLeftCol.width = (m_nLeftWidth + dx) & "px"
				m_elRightCol.width = (m_nRightWidth - dx) & "px"
			elseif dx < 0 then
				m_elLeftCol.width = "1px"
				m_elRightCol.width = m_nCombWidth & "px"
			elseif dx > 0 then
				m_elLeftCol.width = m_nCombWidth & "px"
				m_elRightCol.width = "1px"
			end if
		end sub

		sub ReleaseMouse()
			dim nCell, elCell, nHeadCellWidth, elTable, nTables, elCells
			'clear handlers and release capture
			m_elDragTab.onmousemove = null
			m_elDragTab.onmouseup = null
			m_elDragTab.releaseCapture()

			'top level table: unbind, adjust cell widths, rebind (remember headtable has extra tab cells)
			nCell = m_elLeftCol.cellIndex / 2
			m_elMasterTable.datasrc = ""
			set m_elMasterTable.onreadystatechange = GetRef("CheckTableBinding")
			set elCell = m_elMasterTable.rows(0).cells(nCell)
			Convert2PercentWidth m_elLeftCol, elCell
			Convert2PercentWidth m_elRightCol, elCell.nextSibling
			m_elMasterTable.datasrc = "#" & DataXML

			'don't adjust subtables for subobjects
			if not m_bSubObject then
				nTables = m_elMasterTable.all.tags("TABLE").length
				'2rd-teir table: unbind, adjust cell widths, rebind
				if nTables > 0 then
					set elTable = m_elMasterTable.all.tags("TABLE")(0)
					if elTable.rows.length > 0 then
						elTable.datasrc = ""
						set elTable.onreadystatechange = GetRef("CheckTableBinding")
						set elCell = elTable.rows(0).cells(nCell)
						if not elCell is nothing then
							Convert2PercentWidth m_elLeftCol, elCell
							Convert2PercentWidth m_elRightCol, elCell.nextSibling
						end if
						elTable.datasrc = "#" & DataXML
					end if
				end if
				'3rd-teir table: unbind, adjust cell widths, rebind
				if nTables = 2 then
					set elTable = m_elMasterTable.all.tags("TABLE")(1)
					if elTable.rows.length > 0 then
						elTable.datasrc = ""
						set elTable.onreadystatechange = GetRef("CheckTableBinding")
						set elCell = elTable.rows(0).cells(nCell)
						if not elCell is nothing then
							Convert2PercentWidth m_elLeftCol, elCell
							Convert2PercentWidth m_elRightCol, elCell.nextSibling
						end if
						elTable.datasrc = "#" & DataXML
					end if
				end if
			end if
		end sub

		sub Convert2PercentWidth(elHeaderCell, elCell)
			dim nHeadCellWidth
			nHeadCellWidth = CLng(elHeaderCell.clientWidth/m_nTotalWidth * 100)
			if nHeadCellWidth = 0 then
				elCell.width = "1px"
				elHeaderCell.width = "1px"
			else
				elCell.width = nHeadCellWidth & "%"
				elHeaderCell.width = nHeadCellWidth & "%"
			end if
		end sub

		sub CheckTableBinding()
			dim elSource, xmlRecords
			set elSource = window.event.srcElement
			if elSource.readyState = "complete" then
				set elSource.onreadystatechange = nothing
				set xmlRecords = m_xmlDataDoc.selectNodes("record")
				ResetSelection elSource.rows, xmlRecords
			end if
		end sub

		sub ResetSelection(elRows, xmlRecords)
			dim elRow, elKey, xmlRecord, i, nAdjust
			if elRows.length = xmlRecords.length then
				nAdjust = 1
			else
				nAdjust = 2
			end if
			if xmlRecords.length > 0 and m_dSelectedRows.count > 0 then
				for i = 0 to (elRows.length/nAdjust) - 1
					set elRow = elRows(i * nAdjust)
					set xmlRecord = xmlRecords(i)
					if not isNull(xmlRecord.getAttribute("selected")) then
						AddClass elRow, "lsRowSelected"
						set m_dSelectedRows(xmlRecord.selectSingleNode("bd_queryid").text) = elRow
					end if
				next
			end if
		end sub

		sub SetPage(nNewPage)
			if not isNumeric(nNewPage) then exit sub
			if Cint(nNewPage) < 

⌨️ 快捷键说明

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