function dataSourcePopupHandler(id) {
fs = NodeRoutings.cells(id,1).getValue() ;
$("#CostDialog").dialog(“open”);
doInitDataSourceGrid(id);
dataSourceGrid.filterBy(0,function(v){
if(fs == “”)return true;
return v == fs ;
})
}
function doInitDataSourceGrid(id){
dataSourceGrid = new dhtmlXGridObject(‘dataSourceGrid_container’);
dataSourceGrid.setImagePath("<%=request.getContextPath()%>/public/dhtmlx/dhtmlxGrid/codebase/imgs/");
setColumnHeaders(id);
dataSourceGrid.setInitWidths(“41,41,41,41,41,41,41”);
dataSourceGrid.setColAlign(“center,center,center,center,center,center,center”);
dataSourceGrid.setColSorting(“str,str,str,int,str,str,str”);
//dataSourceGrid.setColSorting(“str,str,str,str”);
dataSourceGrid.setColTypes(“ro,ch,ro,ro,ro,ro,ro”);
dataSourceGrid.setSkin(“light”);
dataSourceGrid.enableAutoHeight(true);
//dataSourceGrid.enablePaging(false, 10, 10);
dataSourceGrid.enableMultiline(false);
dataSourceGrid.init();
dataSourceGrid.parse(document.getElementById(‘dataSourceGridString’).value,“xml”);
//dataSourceGrid.sortRows(3,“str”,“asc”);
}
Tring to sort the dataSourceGrid : after dataSourceGrid.filterBy: However unable to sort by Col index 3 :dataSourceGrid.sortRows(3,“str”,“asc”);
a) please be sure that sortRows is called before filterBy ( after first filtering, grid will lock original row order and will reuse it for next filtering - it can be resolved if necessary )
b) You are have “int” as sorting type for 4th column , so be sure that data in that column can be processed as numeric values ( parseFloat will be used to convert cell values to numbers ), if data is not parsable - grid will not be able to sorts correctly.