Skip navigation
Currently Being Moderated

Change the Nextensio Default Column Sorting to DESC/ASC..

May 22, 2012 7:04 PM

One thing that has baffled me is how to change the default sort behavior of a Nextensio List to sort DESC first..

 

- For example, currently when you click a column heading, the list will first Sort Ascending..

- clicking the Column heading again, the list will Sort Descending..

 

Question: How do I reverse this to make it sort DESC, then ASC?

 

- I know the code for sorting is inside the TSO_TableSorter.cfc file in /includes/tso/ folder..

- I have tried changing some of the values in lines 58, 83, 97 but could not make it work in reverse..

 

Here is the code from the TSO_TableSorter.cfc.. notice the sections highlighted in Red..

- I tried various combinations/changes of DESC values to ASC, but it either gives no sorting at all, or has no effect..

 

--------------------------------------------------------

<cfcomponent displayname="TSO_TableSorter">

<!---

ADOBE SYSTEMS INCORPORATED

Copyright 2007 Adobe Systems Incorporated

All Rights Reserved

 

NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the

terms of the Adobe license agreement accompanying it. If you have received this file from a

source other than Adobe, then your use, modification, or distribution of it requires the prior

written permission of Adobe.

--->

 

<!---

Copyright (c) InterAKT Online 2000-2005

--->

 

<cffunction name="init" output="false">

<cfargument name="rsName" type="string" required="yes">

<cfargument name="sorterName" type="string" required="yes">

 

<cfset this.columns = StructNew()>

<cfset this.rsName = rsName>

<cfset this.sorterName = sorterName>

<cfset this.defaultSort = "">

 

<cfset Request.KT_SessionKtBack(Request.KT_getFullUri())>

<cfif Len(sorterName) GT 4>

<cfset SESSION['KT_lastUsedList'] = Right(sorterName,Len(sorterName)-4)>

</cfif>

</cffunction>

 

<cffunction name="addColumn" output="false">

<cfargument name="colName" type="string" required="yes">

<cfif NOT StructKeyExists(this.columns, colName)>

<cfset this.columns[colName] = true>

</cfif>

</cffunction>

 

<cffunction name="setDefault" output="false">

<cfargument name="defaultColumn" type="string" required="yes">

 

<cfset var sorter_reference = "sorter_" & this.sorterName>

 

<cfset this.defaultColumn = defaultColumn>

<cfif NOT StructKeyExists(SESSION, sorter_reference)>

<cfset SESSION[sorter_reference] = defaultColumn>

</cfif>

</cffunction>

 

<cffunction name="Execute" output="false">

<cfset var sorter_reference = "sorter_" & this.sorterName>

<cfset var sorterString = "">

<cfset var columnName = "">

<cfset var tmpUrl = "">

 

<cfif StructKeyExists(URL,sorter_reference)>
<cfset sorterString = URL[sorter_reference]>
<cfset columnName = ReplaceNoCase(sorterString," DESC", "", "all")>
<cfif StructKeyExists(this.columns,columnName)>
<cfset SESSION[sorter_reference] = URL[sorter_reference]>
<cfset tmpUrl = Request.KT_addReplaceParam(Request.KT_getFullUri(), sorter_reference)>
<cfset Request.KT_redir(tmpUrl)>
</cfif>
</cfif>

</cffunction>

 

<cffunction name="getCurrentSort" output="false" returntype="string">

<cfset var value = this.defaultColumn>

<cfset var sorter_reference = "sorter_" & this.sorterName>

 

<cfif StructKeyExists(SESSION,sorter_reference)>

<cfset value = SESSION[sorter_reference]>

</cfif>

<cfreturn value>

</cffunction>

 

<cffunction name="getSortIcon" output="false" returntype="string">
<cfargument name="column" type="string" required="yes">
<cfset value = this.getCurrentSort()>

<cfif value EQ column>
<cfreturn 'KT_asc'>
<cfelseif value EQ column & ' DESC'>
<cfreturn 'KT_desc'>
</cfif>
</cffunction>

 

<cffunction name="getSortLink" output="false" returntype="string">

<cfargument name="column" type="string" required="yes">

 

<cfset var sorter_reference = "sorter_" & this.sorterName>

<cfset var value = this.getCurrentSort()>

<cfset var paramVal = column>

<cfset var tmpUrl = "">

 

<cfif value EQ column>
<cfset paramVal = paramVal & " DESC">
</cfif>

<cfset tmpUrl = Request.KT_addReplaceParam(Request.KT_getFullUri(), sorter_reference, paramVal)>

<cfreturn tmpUrl>

</cffunction>

 

</cfcomponent>

 

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points