Custom Column Sort in Dojo Datagrid Programmatically

I created the dojox.grid.datagrid program code, and I need special sorting by columns. For this, I tried using ItemFileWriteStore.comparatorMap['field'] = comparatorFunc . But my comparator function is never called.

Any idea what I'm missing here?

+4
source share
1 answer

I performed a selective sort by data grid. (Dojo -1,4) sample code here:

 function(response, ioArgs){ queryGrid.queryOptions={ignoreCase:true}; queryGrid.setStore(new dojo.data.ItemFileReadStore(response[responseResult])); setCustomSort(queryGrid.store); .. } function setCustomSort(store){ if(!store.comparatorMap){ store.comparatorMap = {}; } store.comparatorMap["unresolvedHrs"] = sortNum; store.comparatorMap["tat"] = sortNum; } function sortNum(a, b){ var _a = convertTimeToNum(a); var _b = convertTimeToNum(b); var ret = 0; if (_a > _b) { ret = 1; } if (_a < _b) { ret = -1; } return ret; } 

Here convertTimeToNum - convert the value of the time format to a number in minutes.

0
source

All Articles