Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 10-03-2012, 03:15 PM   PM User | #1
deepthiz
New Coder

 
Join Date: May 2011
Posts: 16
Thanks: 1
Thanked 0 Times in 0 Posts
deepthiz is an unknown quantity at this point
Coldfusion pagination and search

I have the below code on a coldfusion page. This page displays the data from the query below having 25 records per page with pagination. Now i need to provide a textbox and search button so that the user can enter the positionid and hit search....the problem im havign here is how can the nth page be displayed if the positionid is in for example 7th page out of 200 pages. please advice. thanks

<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#


<cfoutput query="qry_postn_detail" startrow="#url.start#" maxrows="#perpage#">
<tr>
<td align="center">
<input type="checkbox" name="vSelection" value="#currentrow#"></td>
<td align="CENTER">#position_id#
<input type="hidden" name="vpostn" value="#position_id#">
</td>
<td align="CENTER">
<cfset vsch_grp = schedule_group>
<select name="vschgrp">
<cfloop query="allschedgrp">
<option value="#schedule_group#" <cfif vsch_grp eq schedule_group>Selected</cfif> >#schedule_group#</option>
</cfloop>
</select>
</td>
<td align="CENTER">
<cfset vacrr_prof = accrual_profile>
<select name="vaccprof">
<cfloop query="allaccrprof">
<option value="#accrual_profile#" <cfif vacrr_prof eq accrual_profile>Selected</cfif> >#accrual_profile#</option>
</cfloop>
</select>
</td>
<td align="CENTER">
<cfset vpay_rule = pay_rule_name>
<select name="vpayrul">
<cfloop query="allpayrulename">
<option value="#pay_rule_name#" <cfif vpay_rule eq pay_rule_name>Selected</cfif> >#pay_rule_name#</option>
</cfloop>
</select>
</td>
<td align="CENTER">
<cfset vrest_days = rest_days>
<select name="vrestdays">
<cfloop query="allrestdays">
<option value="#rest_days#" <cfif vrest_days eq rest_days>Selected</cfif> >#rest_days#</option>
</cfloop>
</select>
</td>
</tr>
</cfoutput>
deepthiz is offline   Reply With Quote
Reply

Bookmarks

Tags
coldfusion, javascript

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:05 PM.


Advertisement
Log in to turn off these ads.