How can I stop a datagrid from sorting when the user clicks in the column header. Removing the header is not an option as I need them. I don't want the column header to sort but need them to allow resizing columns. If possible, it's not obvious from the docs.
Ismo
Prevent data grid from sorting
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Prevent data grid from sorting
Hello ibe,
Whilst not exactly answering your question, being able to reset sorting in the grid is related to your question and very useful especially when organising data before performing calculations on DataGrid values. It may negate the need to disable sorting, because you can reset whenever you like.
I have not had the necessity to disable sorting altogether, as I can restore/reset sort order before updates or other operations using the above method (and users love sorting), however I believe you may disable sorting by altering the column template of the DataGrid.
I hope this helps.
Kind regards, Andrew
Whilst not exactly answering your question, being able to reset sorting in the grid is related to your question and very useful especially when organising data before performing calculations on DataGrid values. It may negate the need to disable sorting, because you can reset whenever you like.
Code: Select all
on mouseUp
-- reset sorting in grid
set the dgProps["sort by column"] of group "DataGrid 1" to empty
end mouseUp
I hope this helps.
Kind regards, Andrew
Finally found the answer. Just in case anyone else needs it, the simple way is to add the below code to the data grid script:
on SortDataGridColumn pColumn
end SortDataGridColumn
This will prevent all columns from sorting and changing the header appearance. I found the answer here:
http://revolution.screenstepslive.com/s ... n-Sorting-
which seems interesting for those who need specialized sorting.
on SortDataGridColumn pColumn
end SortDataGridColumn
This will prevent all columns from sorting and changing the header appearance. I found the answer here:
http://revolution.screenstepslive.com/s ... n-Sorting-
which seems interesting for those who need specialized sorting.