PDA

View Full Version : To get the column name



Pankaj Kumar M
19 May 2016, 6:35 AM
Hi,
I need to get the column name when sort is changed in cfgrid.

I'm getting the sort direction but not sorted column.




//javascript

function sortchange(ct, column, direction, eOpts ){
alert(column.direction);
//Here i need which column is getting sorted
}

fnGridPaging=function(){
grid = ColdFusion.Grid.getGridObject('gridName');
grid.addListener('sortchange',sortchange);
}

//coldfusion code for cfgrid

<cfgrid format="html" name="gridName" selectmode="row" pagesize="10" bind="cfc:cfc.importedselectedfiles.getImportedSelectedFiles({cfgridpage},{cfgridpagesize},{cfgridsortcolumn},{cfgridsortdirection})" >
<cfgridcolumn name="Id" width="75" header="Id" headerbold="true" />
<cfgridcolumn name="NAME" width="130" header="Name" headerbold="true" />
<cfgridcolumn name="CREATED_DT" width="130" header="Created Date" headerbold="true" />
</cfgrid>

// ajax function
<cfset ajaxOnLoad("fnGridPaging")>