Search code examples
extjscoldfusionextjs4.1coldfusion-2016

How to retrieve the sort column and direction of a grid using Ext/JS 4.1


We upgraded from ColdFusion 9 to ColdFusion 2016 and some code that we had been using is no longer working. It looks like ColdFusion 2016 is using Ext/JS 4.1 and I'm not sure how to retrieve this information using this version.

Current code is:

var mygrid = ColdFusion.Grid.getGridObject('rosterGrid');
var params = mygrid.getStore().lastOptions.params;
var sort = params.sort;
var dir = params.dir;

I cannot find the equivalent for the lastOptions.params in 4.1. I need to get the sort column and direction for the grid.


Solution

  • Try this:

    var sorter = mygrid.getStore().sorters.getAt(0); var sort = sorter.property; var dir = sorter.direction;