StephleHardi
2022-03-27T06:50:36Z
Hello,

I have a grid with several columns and I would like to sort only the data of column #3 by clicking in its header but without sorting the other columns.

Is it possible ?

Thanks very much

Igor/10Tec
2022-03-28T15:24:05Z
iGrid does not have a built-in tool for that. I think you need to process the ColHdrClick event. Disable the built-in sort in the event handler by setting e.DoDefault to False, export the column cell values into an array, sort it, and upload back into the column. Something like that.
StephleHardi
2022-03-28T16:32:45Z
It's a pity that this function is not implemented but your solution suits me well.

Thanks very much

Here is my code (VB) according to your advice and it works very well

Private Sub GL_ColHdrClick(sender As Object, e As iGColHdrClickEventArgs) Handles GL.ColHdrClick
e.DoDefault = False
Static Ascending As Boolean
Dim Mg As String, CPT, i As Integer

With GL
Dim MyArray(.Rows.Count - 1) As String
For i = 0 To .Rows.Count - 1
Mg = .CellValues(i, e.ColIndex) : If Ztrim(Mg) <> "" Then MyArray(i) = Mg
Next

Array.Sort(MyArray) : If Ascending = False Then Array.Reverse(MyArray) 'Ascending or descending

Ascending = Not Ascending

For i = 0 To MyArray.Count - 1
If MyArray(i) <> "" Then .CellValues(CPT, e.ColIndex) = MyArray(i) : CPT += 1 ' CPT to Avoid blank lines
Next

End With
End Sub