我在 ColdFusion 页面上有以下代码。此页面显示来自以下查询的数据,每页有 25 条记录,分页。现在我需要提供一个文本框和搜索按钮,以便用户可以输入 positionid 并点击搜索....我在这里遇到的问题是,如果 positionid 在例如第 7 页中,如何显示第 n 页200 页。请指教。谢谢
<cfquery name="qry_postn_detail" datasource="mbtran">
select distinct position_id,schedule_group,accrual_profile,pay_rule_name,rest_days
from kronos_if.position_detail
order by position_id
</cfquery>
<cfset perpage = 25>
<cfparam name="url.start" default="1">
<cfif not isNumeric(url.start) or url.start lt 1 or url.start gt qry_postn_detail.recordCount or round(url.start) neq url.start>
<cfset url.start = 1>
</cfif>
<cfset totalPages = ceiling(qry_postn_detail.recordCount / perpage)>
<cfset thisPage = ceiling(url.start / perpage)>
<cfset thisPage = Int(start / 25) + 1>
Page<cfoutput>
<cfloop from="1" to="#totalPages#" index="i">
<cfif i is thisPage>
#i#
<cfelse>
<cfif totalPages lte 5 or i is 1 or i is totalPages or (i gt thisPage - 3 and i lt thisPage + 3) or ((thisPage is 1 or thisPage is 2) and i lt 6) >
<a href="?start=#(i*25)-24#">#i#</a>
<cfelse>
<cfif i is 2 or i is totalPages - 1>
...
</cfif>
</cfif>
</cfif>
</cfloop>
</cfoutput>