我在ColdFusion页面上有下面的代码。此页面显示下面的查询中的数据,每页有25条记录并附有分页。现在我需要提供一个文本框和搜索按钮,以便用户可以输入positionid并点击搜索....我在这里遇到的问题是,如果positionid在例如第7页出现时如何显示第n页200页。请指教。谢谢Coldfusion分页和搜索
<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>
你能提供一些关于你如何工作的更多细节吗?你提到添加一个文本框进行搜索,但你说他们输入一个特定的positionid。您想要在搜索后再次显示所有结果,还是只想记录匹配的内容?还是你想显示可点击的页码在这些页面的结果之间来回切换?更多详细信息请... –
当用户输入positionid并点击搜索结果必须显示匹配的搜索结果....与可点击的页码来回去......抱歉不清楚.... – user747291