📄 listsheet.htc
字号:
sub ShowWaitDisplay()
'set loading flag and show wait display and wait cursor
m_bLoading = true
m_elWaitDisplay.style.display = "block"
if not bHasClass(element, "wait") then addclass element, "wait"
end sub
sub hideWaitDisplayEx()
'if table bound and document loaded
if window.event.srcElement.readyState = "complete" and _
element.document.readyState = "complete" then
HideWaitDisplay()
end if
end sub
sub HideWaitDisplay()
'reset loading flag and hide wait display and wait cursor
m_bLoading = false
m_elWaitDisplay.style.display = "none"
removeClass element, "wait"
end sub
sub AddHeaderCell(sID, sLabel, bSort, sWidth, nCols)
dim elHeadRow, elHeaderCellTemp, elCell, elNoBr, elButton
set elHeaderCellTemp = element.document.createElement("TH")
set elHeadRow = m_elHeadTable.rows(0)
set elCell = elHeadRow.appendChild(elHeaderCellTemp.cloneNode(true))
with elCell
.className = "lsCell"
.width = sWidth & "%"
.nowrap = true
end with
if bSort then
'add sort button
set elButton = elCell.appendChild(element.document.createElement("BUTTON"))
with elButton
.id = sID
.innerText = sLabel
.title = sFormatString(L_SortBy_ToolTip, Array(sLabel))
.className = "lsSortButton"
.attachEvent "onclick", GetRef("onClickHeader")
.style.width = "100%"
end with
else
'add header label
with elCell
.id = sID
.innerText = sLabel
.title = sLabel
.className = "lsNoSort"
end with
end if
'set column spacer tab to grab for column resizing
if elHeadRow.cells.length < nCols + nCols - 1 then
set elCell = elHeadRow.appendChild(elHeaderCellTemp.cloneNode(true))
with elCell
.className = "lsSpacer"
.style.width = "3px"
.innerHTML = " "
.attachEvent "onmousedown", GetRef("CaptureMouse")
end with
end if
end sub
sub AddExpandIcon(elCell)
dim elSpan
set elSpan = elCell.appendChild(element.document.createElement("SPAN"))
with elSpan
.id = "expandicon"
.setAttribute "name", "expandicon"
.style.fontFamily = "Tahoma, MS Sans Serif, sans-serif"
.innerText = PLUS
.className = "bdexpandicon"
end with
end sub
sub AddQueryID(elCell)
dim elSpan
set elSpan = elCell.appendChild(element.document.createElement("SPAN"))
with elSpan
.id = "key"
.setAttribute "datafld", "bd_queryid"
.style.display = "none"
end with
end sub
function elGetCell(elRow, sWidth)
set elGetCell = elRow.insertCell()
with elGetCell
.className = "lsCell"
.width = sWidth & "%"
.nowrap = false
.style.Overflow = "hidden"
on error resume next
.style.textOverflow = "ellipsis"
on error goto 0
end with
end function
sub AddBindSpan(elCell, sID, sFormat)
dim elSpan
if sID <> "" then
set elSpan = elCell.appendChild(element.document.createElement(""))
set elSpan = elSpan.appendChild(element.document.createElement("SPAN"))
if sFormat = "select" then
elSpan.setAttribute "datafld", sID & "_displayvalue"
else
elSpan.setAttribute "datafld", sID
end if
end if
elCell.insertAdjacentHTML "afterBegin", " "
end sub
sub AddSelectionControls()
dim elRow, elCell
set m_elSelControls = m_elPageContainer.rows(0).cells(0).appendChild(element.document.createElement("TABLE"))
with m_elSelControls
.cellSpacing = 0
.cellPadding = 0
.id = "selectcontrols"
.className = "lsSelectButtons"
end with
set elRow = m_elSelControls.insertRow()
' add a button per cell
set elCell = elRow.insertCell()
elCell.style.padding = 0
set m_elSelAllBtn = elCell.appendChild(element.document.createElement("BUTTON"))
with m_elSelAllBtn
.id = "btnSelectAll"
.className = "bdbutton"
.innerHTML = L_SelectAllBtn_Button
.style.margin = 0
end with
set elCell = elRow.insertCell()
elCell.style.padding = 0
elCell.style.paddingLeft = 4
set m_elUnselAllBtn = elCell.appendChild(m_elSelAllBtn.cloneNode(true))
with m_elUnselAllBtn
.id = "btnUnselectAll"
.style.margin = 0
.innerHTML = L_UnselectAllBtn_Button
.attachEvent "onclick", GetRef("onUnselectAll")
end with
m_elSelAllBtn.attachEvent "onclick", GetRef("onSelectAll")
'set button disabled default based on list selected or not
if m_bSelectAll then
m_elSelAllBtn.disabled = true
else
m_elUnselAllBtn.disabled = true
end if
end sub
sub AddPageControls()
dim elSpan, elSpanTemp, elButtonTemp, elTable, elTableTemp, elRow1, elRow, elCell
set elTableTemp = element.document.createElement("TABLE")
elTableTemp.cellSpacing = 0
elTableTemp.cellPadding = 0
set elSpanTemp = element.document.createElement("SPAN")
set elButtonTemp = element.document.createElement("BUTTON")
elButtonTemp.className = "bdbutton lsPageButton"
'create container table
set m_elPageContainer = element.appendChild(elTableTemp.cloneNode(true))
m_elPageContainer.style.marginTop = "4px"
m_elPageContainer.width = "100%"
set elRow = m_elPageContainer.insertRow()
' add recordcount display and selection buttons to first cell
set elCell = elRow.insertCell()
elCell.width = "100%"
elCell.nowrap = true
elCell.style.padding = 0
set m_elRecordcountDisplay = elCell.appendChild(elTableTemp.cloneNode(true))
m_elRecordcountDisplay.style.margin = "4px"
m_elRecordcountDisplay.style.display = "none"
set elRow1 = m_elRecordcountDisplay.insertRow()
set elCell = elRow1.insertCell()
elCell.nowrap = true
elCell.innerText = L_ListTotal_Text
set m_elTotalRecords = elRow1.insertCell()
m_elTotalRecords.nowrap = true
m_elTotalRecords.id = "bdtotalrecords"
' add select all and unselect all buttons
if m_bMultiSelect and m_bSelectionButtons then
'create select all/unselect all buttons
AddSelectionControls()
end if
' add page number display and page buttons to second cell
set elCell = elRow.insertCell()
elCell.nowrap = true
elCell.vAlign = "top"
set m_elPageDisplay = elCell.appendChild(elTableTemp.cloneNode(true))
m_elPageDisplay.style.margin = "4px"
m_elPageDisplay.style.display = "none"
set elRow1 = m_elPageDisplay.insertRow()
set elCell = elRow1.insertCell()
elCell.nowrap = true
elCell.innerHTML = L_Page_Text
set m_elCurPage = elRow1.insertCell()
m_elCurPage.nowrap = true
m_elCurPage.id = "bdcurpage"
'create page buttons and input
set elCell = elRow.insertCell()
elCell.style.padding = 0
elCell.nowrap = true
elCell.vAlign = "top"
set m_elPageControlsDisplay = elCell.appendChild(elTableTemp.cloneNode(true))
m_elPageControlsDisplay.id = "lspagecontrols"
m_elPageControlsDisplay.style.display = "none"
set elRow = m_elPageControlsDisplay.insertRow()
' first button
set elCell = elRow.insertCell()
elCell.style.padding = 0
set m_elFirstPageBtn = elCell.appendChild(elButtonTemp.cloneNode(true))
with m_elFirstPageBtn
.id = "btnFirst"
.title = L_FirstPage_ToolTip
.innerText = FIRST_ARROW
.attachEvent "onclick", GetRef("onFirst")
.disabled = true
end with
' back button
set elCell = elRow.insertCell()
elCell.style.padding = 0
set m_elBackPageBtn = elCell.appendChild(elButtonTemp.cloneNode(true))
with m_elBackPageBtn
.id = "btnBack"
.title = L_BackPage_ToolTip
.innerText = LEFT_ARROW
.attachEvent "onclick", GetRef("onBack")
.disabled = true
end with
'set page number input
set elCell = elRow.insertCell()
elCell.style.padding = 0
set m_elPageNumInput = elCell.appendChild(element.document.createElement("INPUT"))
m_elPageNumInput.type = "text"
with m_elPageNumInput
.id = "inputPageNumber"
.className = "lsPageText"
.maxlength = 4
.title = L_PageInput_ToolTip
.attachEvent "onchange", GetRef("onNewPage")
.attachEvent "onblur", GetRef("onNewPage")
.attachEvent "onfocus", GetRef("onFocus")
.attachEvent "onkeydown", GetRef("onKeyDownPage")
end with
' next button
set elCell = elRow.insertCell()
elCell.style.padding = 0
set m_elNextPageBtn = elCell.appendChild(elButtonTemp.cloneNode(true))
with m_elNextPageBtn
.id = "btnNext"
.title = L_NextPage_ToolTip
.innerText = RIGHT_ARROW
.attachEvent "onclick", GetRef("onNext")
.disabled = true
end with
' last button
set elCell = elRow.insertCell()
elCell.style.padding = 0
set m_elLastPageBtn = elCell.appendChild(elButtonTemp.cloneNode(true))
with m_elLastPageBtn
.id = "btnLast"
.title = L_LastPage_ToolTip
.innerText = LAST_ARROW
.attachEvent "onclick", GetRef("onLast")
.disabled = true
end with
end sub
sub SetPageControls()
dim nRemainder
'get page size
if isNull(m_nPageSize) or not isNumeric(m_nPageSize) then m_nPageSize = 20
if CLng(m_nPageSize) <= 0 then m_nPageSize = 20
'get recordcount
if isNull(m_nRecordcount) or not isNumeric(m_nRecordcount) then
m_nRecordcount = MAX_RECORD_COUNT
else
on error resume next
m_nRecordcount = CLng(m_nRecordcount)
if Err.number <> 0 or m_nRecordcount > MAX_RECORD_COUNT then
m_nRecordcount = MAX_RECORD_COUNT
msgbox L_TooManyRecords_ErrorMessage, vbOKOnly, L_Warning_DialogTitle
end if
if m_nRecordcount = UNKNOWN_RECORD_COUNT then
m_nRecordcount = MAX_RECORD_COUNT
end if
on error goto 0
end if
'calculate current page and page count
if CLng(m_nRecordcount) > CLng(m_nPageSize) then
m_nPageCount = CLng(m_nRecordcount/m_nPageSize)
nRemainder = m_nRecordcount - m_nPageCount * m_nPageSize
if m_nRecordcount = -1 then m_nPageCount = MAX_PAGE_COUNT
If (nRemainder > 0) then
m_nPageCount = m_nPageCount + 1
end if
if m_nPageCount > MAX_PAGE_COUNT then
m_nPageCount = MAX_PAGE_COUNT
if m_nRecordcount < MAX_RECORD_COUNT then msgbox L_TooManyPages_ErrorMessage, vbOKOnly, L_Warning_DialogTitle
end if
if isNull(m_nCurPage) or not isNumeric(m_nCurPage) then m_nCurPage = 1
if m_nCurPage <= 0 then m_nCurPage = 1
m_nCurPage = cLng(m_nCurPage)
else
m_nPageCount = 1
m_nCurPage = 1
end if
if m_nRecordcount = MAX_RECORD_COUNT then
m_nPageCount = MAX_PAGE_COUNT
end if
'add values for recordcount and pages
if m_bPageControls then
if m_nRecordcount > 0 then
'show recordcount
m_elTotalrecords.innerText = FormatNumber(m_nRecordcount,0)
end if
if m_nPageCount > 1 and m_nPageCount <> MAX_PAGE_COUNT and m_nRecordcount > 0 then
'show current and total pages
m_elCurPage.innerText = FormatNumber(m_nCurPage,0) & " /" & FormatNumber(m_nPageCount,0)
else
'only show current page
m_elCurPage.innerText = FormatNumber(m_nCurPage,0)
end if
m_elPageNumInput.value = m_nCurPage
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -