This is not possible in the datagrid widget. Strings/dates will be aligned to the left, numbers to the right
But it is possible in the Datagrid 2 widget: https://docs.mendix.com/appstore/modules/data-grid-2/
Which can be downloaded here: https://marketplace.mendix.com/link/component/116540
Check the below link for reference
Hope it helps!!!