Turn of sorting by header in data grid

1
Is it possible to turn off the sorting by header on a datagrid? Currently if you click on a header (in a standard datagrid) it will asc/desc sort based on that collumn. Is it possible to turn this feature off?
asked
3 answers
-2

Hi Niels,

It is not possible to disable the sorting possabilities of a datagrid column.

If you know the resultset is always small, a workaround could be to retrieve the data using a microflow instead of using XPath. When data is retrieved with a microflow a datagrid is unable to filter and sort the data. Be aware that when your resultset is very large this will cause performance issues.

answered
4

It is as mentioned previously, sorting can’t be disabled on a datagrid using Mendix till now. However, this can be done using CSS. You will need to set the pointer event property to none. Below is the definition of the class “datagridwithoutsorting ” that should be used on the datagrid that you want to disable sorting on.

.datagridwithoutsorting th { /* disabling pointer events */
    pointer-events: none;
}
.datagridwithoutsorting .mx-datagrid-column-resizer { /* enabling the column sizer */
    pointer-events: auto;
}

 

answered
-3

A cleaner approach is to add a calculated attribute returning the same value as the stored attribute. In Data Grid 1 clicking on a calculated attribute column header does not cause sorting

answered