Remove the filter option in the gridcontrol title

Good afternoon.

I have a gridcontrol in a dialog. When I click on the gridcontrol title, the data is sorted in ascending order. I wanted to remove this option in the gridcontrol title, leaving the title “locked”. Does anyone know how to remove this?

Hello,
.
You do not specify how you are creating the grid control - all code or using the GUI (partial construct).
.
The sort option is eliminated if you use DefaultGridDataModel.
.
See > Grid control headers sorting feature

This code was exactly what I needed. But, I put createUnoService(“com.sun.star.awt.grid.DefaultGridDataModel”) and the data did not load. I use the code I found in that attached file.
Controle-tabela-dialogo.ods (16.1 KB)

Add to the IniciarDialogomacro the line

 CarregarDados()

before

 oDialogo.Execute()

@Eliel_Francklim
.
Based upon your design, the loading of the data is done when the button on the dialog is pressed.
.
Also do not see where you used DefaultGridDataModel in the code. Columns still sort.
.
Edit
.
Seeing as there is no response yet, here is the code to fix:

After:

   'Criar controle tabela
   oTabela = oDialogo.Model.createInstance("com.sun.star.awt.grid.UnoControlGridModel")
   with oTabela
     .PositionX = 10
     .PositionY = 10
     .Width = 171
     .Height = 85
   end with

.
add:

 	oDataModel = createUnoService("com.sun.star.awt.grid.DefaultGridDataModel")
 ' Insert data
    oDataModel.addRow("1", array(""))
	oTabela.GridDataModel = oDataModel

.
After starting the dialog, press your button and your data appears without column sorting ability.

It worked out. Thank you very much.