Created
April 11, 2018 20:14
-
-
Save nathan5x-zz/f22b5bad914b867db31b5f550b0a5b1a to your computer and use it in GitHub Desktop.
Adding sort icon to Dojo Data Grid
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 displayDefaultSortIcon(grid, fieldName){ | |
if(grid && grid.layout) { | |
dojo.forEach(grid.layout.cells, function(cell, idx) { | |
if(cell.field === fieldName) { | |
var targetCell = $('#'+cell.id); | |
if(targetCell) { | |
targetCell.attr("aria-sort","descending"); | |
var domToAddSortIcon = $(targetCell.find('.dojoxGridSortNode')); | |
if(domToAddSortIcon) { | |
domToAddSortIcon.empty(); | |
domToAddSortIcon.toggleClass('dojoxGridSortDown'); | |
domToAddSortIcon.html('<div class="dojoxGridArrowButtonChar">▼</div>\ | |
<div class="dojoxGridArrowButtonNode" role="presentation"></div>\ | |
<div class="dojoxGridColCaption">'+cell.name+'</div>'); | |
} | |
} | |
grid.setSortIndex(idx,false); | |
} | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment