1, first need to open views of the optionscustomize.columnsorting
2, and then set the sorting of each column
3, if you need to sort the design period, it is necessary to set this
SortOrder Properties, note that if you set soring to Sonone properties with your code, you need to refer to the Dxcore unit
Of course if you need to enable multi-column sequencing during the design, you need to set the order of SortIndex
OK, so your program, during the run can support click Cxgrid Table Header Sort, press the Ctrl click will cancel the sorting status of the sequence, press the shift will support multi-column sorting, is not very useful, exclamation dev too powerful.
Of course, add a perfect plan, sometimes the customer will be disorderly, disorderly, but we will give the customer a default sorting scheme, so I was to get the data before the current sorting state:
// remove all sort tvdetail.datacontroller.getitembyfieldname (' ItemID '). SortOrder: = Sonone; for iI: = 0 To gridtableview.columncount-1 do begin // sonone defines Uses dxcore gridtableview.columns[ii] in Dxcore. SortOrder: =sonone; end ;
//Then the code that you re-acquired the data
If Readdataset (strSQL, Cds) Then
Begin
Gridtableview.columns[0]. Applybestfit ();
Edtxh.onchange (EDTXH);
End Else
Begin
Dm_PowerWy.UDBA.GetLastError (Errid, errmsg);
Showmsg_west (' Error ', ' unable to read data! ', ' ERROR hint: ' +LBR + errmsg+lbr+ ' related SQL statement: ' +strsql ';
End
All right, that's it!
On the sorting problem of Cxgrid