当前位置:首页 > 计算机相关 > lotus专区 > 正文内容

LotusScript下的分页

piikee13年前 (2010-07-08)lotus专区279
表单页面放一个域,名字为curpage,域的defaultvalue写上@UrlQueryString 获取URL。再放一个display_list的计算域,用于显示列表和分页导航。
表单的webqueryopen写上@Command([ToolsRunMacro]; "gotopage")调用代理。
后台代理gotopage代码如下:
Sub Initialize
On Error Goto label
Dim session As New NotesSession
Dim db As NotesDatabase
Dim curdoc As NotesDocument
Dim view As NotesView
Dim curpage As Integer '当前页码
Dim count As Integer '文档数量
Dim perpage As Integer '每页条目数量
Dim pages As Integer '页数
Dim ismod As Double '文档数量是否整除于每页数量
Dim i As Integer
Dim tempages As Integer
Dim dbname As Variant
Dim prepage As Integer
Dim pageurl As String
pageurl = "/f_levelandscorem?openform"
perpage = 2 '每页显示的条目数量,这个重点
Set db = session.CurrentDatabase
Set curdoc = session.DocumentContext
Set view = db.GetView("v_levelandscorem")
count = view.EntryCount
'取视图文档
Dim doc As NotesDocument
Set doc = view.GetFirstDocument
Dim tmp As String,htmlstr As String
Dim v As Variant
v = Evaluate("@WebDbName",curdoc)
i = 1
'是否有分页参数,有就不是第一页,必须获取页码
Forall temp In curdoc.curpage
If(Instr(temp,"page")) Then
curpage = Cint(Strright(temp,"="))
Else
curpage = 1
End If
End Forall
htmlstr = "<table border = 1><tr><td>重要性级别</td>"
htmlstr=htmlstr & "<td>点数</td><td>评分标准</td><td>操作</td></tr>"
'============================================================
'计算获得总共可以分多少页
'============================================================
ismod = count Mod perpage
If ismod = 0 Then
pages = Cint( count \ perpage)
tempages = pages
Else
pages = Cint( count \ perpage + 1)
tempages = pages
End If
v = Evaluate("@WebDbName",curdoc)
'=============================================================
'分页
'=============================================================
i = (curpage - 1 ) * perpage + 1
tempages = curpage * perpage
While(i <= tempages And i<=count)
Set doc = view.GetNthDocument(i)
'取文档数据
tmp = doc.important(0)
htmlstr = htmlstr & "<td>" & tmp & "</td>"
tmp = doc.score(0)
htmlstr = htmlstr & "<td>" & tmp & "</td>"
tmp = doc.standard(0)
htmlstr = htmlstr & "<td>" & tmp & "</td>"
'生成编辑
htmlstr = htmlstr & "<td><a href = '/" & v(0) & "/0/" & doc.UniversalID & _
"?editDocument' >编辑</a>"
'生成删除
htmlstr = htmlstr & {&nbsp;&nbsp;<a href='javaScript:deldoc("} & doc.UniversalID & {")'>删除</a>}
htmlstr = htmlstr & "</td></tr>"
i = i + 1
Wend
tempages = pages
htmlstr = htmlstr & "<tr><td colspan = 4><a href='/" &v(0) & "/f_levelandscore?openform'>增加分数和级别</a></td></tr>"
'这里打印分页导航
prepage = curpage
htmlstr = htmlstr & "<tr><td colspan =4 >&nbsp;"
If ((prepage - 1) > 0) Then
htmlstr = htmlstr & {<a href ="/} & v(0) &  pageurl & {&pages=} & Cstr(prepage - 1) & {" >上一页</a>&nbsp;&nbsp;}
End If
i = 1
While(i <=tempages)
htmlstr = htmlstr & {<a href ="/} & v(0) & pageurl & {&pages=} & Cstr(i) & {" >第} & Cstr(i) & {页</a>&nbsp;}
i = i + 1
Wend
i = 1
If (curpage < pages) Then
htmlstr = htmlstr & {<a href ="/} & v(0) & pageurl & {&pages=} & Cstr(curpage + 1) & {" >下一页</a>&nbsp;}
End If
htmlstr = htmlstr & "</td></tr>"
htmlstr = htmlstr & "</table>"
curdoc.display_list = htmlstr
Exit Sub
label:
Msgbox "出错了,错在第 " & Cstr(Erl) & " 行,错误原因:" & Error
End Sub

扫描二维码推送至手机访问。

版权声明:本文由萍客小居发布,如需转载请注明出处。

本文链接:https://www.piikee.net/648.html

分享给朋友:
返回列表

上一篇:lotus专区

下一篇:lotus中的CGI域

相关文章

lotus中的CGI域

为了在域中捕获C G I变量,创建一个以C G I变量命名的文本域(例如, HTTP_COOKIE)。一般地,在编辑状态下将该域设置为隐藏,这样用户就不能改变域中的值。当用户打开表单的时候, HTTP_COOKIE环境变量的实际值变成了域中...

domino中上传控件文件拆离的LS代码

domino中上传控件文件拆离的LS代码Dim inputAttachment As NotesEmbeddedObjectDim v_files As Variantv_files = Evaluate(|@Trim(@Replace(@...

发表评论

访客

◎欢迎参与讨论,请在这里发表您的看法和观点。