This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function reOrder ( vis, sortOrder, col ) { | |
// set the new column first in the new sortorder array | |
var newOrder = [col]; | |
//append all other columns from the current sort order | |
sortOrder.forEach( function ( val ) { | |
if ( val !== newOrder[0] ) { | |
newOrder.push( val ); | |
} | |
} ); | |
var patches = [{ | |
//path to the sortOrder property | |
'qPath': '/qHyperCubeDef/qInterColumnSortOrder', | |
//we want to replace the sort order | |
'qOp': 'replace', | |
//make a string with an array in it | |
'qValue': '[' + newOrder.join( ',' ) + ']' | |
}]; | |
//vis is the visualization model with the applyPatches method | |
vis.applyPatches( patches, true ); | |
return newOrder; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment