I've got a cfgrid that I put together using this tutorial: 
http://www.garyrgilbert.com/tutorials/coldfusion/intermediate/cfgrid.cfm

It is working fine except there is an issue with the sorting of one column, the 
column is called DISPATCHNUM, but the data is not all numeric. The datatype is 
nvarchar and some entries contain letters. The issue is that most of the 
entries are sorting fine, but there are quite a few of them that are out of 
order and I can't figure out why. For instance I'll see 14317, 14316, and 
14313, but 14314 will be 20-30 pages back. I've checked to see if there are 
spaces or anything entered around the number but it is nothing like that. I 
don't know if I have missed something obvious or there is a better way to 
troubleshoot this out there. Thanks!

I have a cfc called joborder.cfc with the following code:
<cffunction name="getJoborders" access="remote">
      <cfargument name="page" required="yes">
      <cfargument name="pageSize" required="yes">
      <cfargument name="gridsortcolumn" required="yes">
      <cfargument name="gridsortdirection" required="yes">

     <cfif arguments.gridsortcolumn eq "">
         <cfset arguments.gridsortcolumn = "dispatchnum" />
         <cfset arguments.gridsortdirection = "desc" />
     </cfif>

   <cfquery datasource="companysql" name="joborders">
      SELECT DISPATCHNUM, SUBMITDATE, WORKCOMPLETE + ' ' as workcomplete, 
EDITDATE, JOBID, ORDERNUM, JOBNAME, CONTACTFIRST, CONTACTLAST, SERVICEENGINEER
      FROM JOBORDERS
      <cfif gridsortcolumn neq ''>
      order by #arguments.gridsortcolumn# #arguments.gridsortdirection#
      </cfif>
   </cfquery>
   <cfreturn queryconvertforgrid(joborders,page,pagesize)/>
   </cffunction>

On the cfm page this is the cfgrid code:


              <cfform>
                          <cfgrid format="html" name="adlist" striperows="yes"  
fontsize="12" pagesize="25" selectmode="row" 
bind="cfc:joborder.getJoborders({cfgridpage},{cfgridpagesize},{cfgridsortcolumn},{cfgridsortdirection})">

                  <cfgridcolumn name="dispatchnum"   header="Dispatch Num" 
href="fieldticket.cfml" hrefkey="jobid" width="100"/>
                  <cfgridcolumn name="submitdate"   header="Submit Date" 
width="90">
                  <cfgridcolumn name="jobname"   header="Job Name" width="200"  
>
                  <cfgridcolumn name="contactlast"  header="Contact Last Name" 
width="150" >
                  <cfgridcolumn name="serviceengineer"   header="Service 
Engineer" width="175" >
                  <cfgridcolumn name="workcomplete"   header="Completed" 
width="100" >
                  <cfgridcolumn name="jobid"   header="Edit " 
href="fieldticketedit.cfml" hrefkey="jobid" width="40" />
                  <cfgridcolumn name="editdate"   header="Edit Date" 
width="80"/>
                  <cfgridcolumn name="jobid"   header="DELETE" hrefkey="jobid" 
width="60" href="delete.cfml?jobid=url.jobid">
                          </cfgrid>
                          </cfform>

--
ExchangeDefender Message Security: Click below to verify authenticity
http://www.exchangedefender.com/verify.asp?id=o8FK66RW024954&from=sa...@tdai.net


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:337097
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to