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

jlig
Posts: 35
Joined: 2010-07-09 16:17

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

Post by jlig » 2012-05-15 22:44

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

jlig
Posts: 35
Joined: 2010-07-09 16:17

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

Post by jlig » 2012-05-16 14:34

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>

User avatar
Fred
Site Admin
Posts: 491
Joined: 2010-02-15 12:10
Location: Armagh, Northern Ireland
Contact:

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

Post by Fred » 2012-05-22 22:20

I also have one instance where I would like to be able to do that.
Sorry I have no solution yet.

Post Reply