Buttons are rendered in the fixed order (Edit, New, Delete, Select, [Custom]) within DevExpress's code, GridViewTableCommandCell.CreateControlHierarchy(). This is fine if you use all of the built-in features of the DevExpress control however if you were to provide a custom button(s) as I have, it's not possible server side to force a custom button to be displayed before or intermingled with a built-in button.
The solution is to handle this client side with a jquery function. There are many possible ways to go about sorting the command column but I wanted to just ensure the if the default delete button was used it would always display last in the command column.
$('td.dxgvCommandColumn').each(function() {
var buttons = $(this).find('img.dxgvCommandColumnItem');
if (buttons.length > 0) {
var lastItem = buttons.last();
$(this).find('img.dxgvCommandColumnItem[title=Remove]').insertAfter(lastItem);
}
});
The command column is rendered for each row in the grid within a table cell with the class "dxgvCommandColumn". This script iterates over each of the command cells in the grid and finds the last button in the default rendered order. Command buttons are rendered as img tags with the class "dxgvCommandColumnItem". It then finds the delete command button using the title within the selector and moves it to after what was the last button. The end result looks like this.
Happy Coding!!