SLokesh
#1
there is an issue in gantt where we have used custom columns when we use custom column, we are not able to add the default options like sort
{ name: “text”, label: “Task Name<span class=‘dxi dxi-chevron-down saar_icon_click saar_schd_common_grid_columns’[data-column-name]=‘text’>”, width: “50”, tree: true, align: “left”, resize: true },
Hello,
You can simply apply the following CSS to prevent the icon from interacting with clicks:
.dxi.dxi-chevron-down.saar_icon_click {
pointer-events: none;
}
Here is an example: DHTMLX Snippet Tool
Alternatively, you can use the onGridHeaderClick
event handler to manually implement sorting:
let direction = false;
function sortByText() {
direction = !direction;
gantt.sort(sortText);
}
function sortText(a, b) {
let textA = a.text ? a.text.toLowerCase() : '';
let textB = b.text ? b.text.toLowerCase() : '';
if (direction) {
return textA > textB ? 1 : (textA < textB ? -1 : 0);
} else {
return textA > textB ? -1 : (textA < textB ? 1 : 0);
}
}
gantt.attachEvent('onGridHeaderClick', (name, e) => {
sortByText(direction);
return true;
});
Take a look at: DHTMLX Snippet Tool