Sorting by database field when using cfdirectory
I have the following working code but need to sort the list by a field (sortID) from my database (not a value from the directory)
- How do I add this?
- I tried adding "sortID" in below, but it doesn't have any effect?
- sortID is a 3 digit varchar field in MySQL
<div data-role="collapsible" data-collapsed="true">
<h3 align="center">Board</h3>
<ul data-role="listview" data-theme="d" data-inset="true">
<cfset DirList = "C:\Inetpub\wwwroot\CRM\CCC\attachments\board\">
<cfset site = ("https://crm.domain.com/crm/ccc/attachments/board/")>
<cfdirectory directory="#DirList#" name="qDir" action="list" sort="sortID DESC">
<cfquery dbtype="query" name="dirsOtherOnly">
SELECT * FROM qDir ORDER BY sortID DESC
</cfquery>
<cfoutput>
<cfloop query="dirsOtherOnly">
<li>
<a href="#site##dirsOtherOnly.name#" title="Click to Preview" target="_blank">#dirsOtherOnly.Name#</a>
</li></cfloop>
</cfoutput>
</ul>
<cfif ("sicr" NEQ "region6" AND #Session.kt_login_user# EQ "john" OR #Session.kt_login_user# EQ "bob")>
<p align="left">Click to add attachment: <cfoutput><a href="ul_l.cfm?id2=500&id5=Board" data-transition="fade" target="_blank">Attachments</a></cfoutput></p>
</cfif>
</div>
