Sorting in tableview

Hi,

Is it possible to dissable the option to sort columns in tableview for certain columns ??

We show some non-stored calulated fields in tableview and it does not make sense to do a sort on these columns.

I would like to disable the sort-option for these columns.

Regards,

The sort can be overridden using the onSortCmd. The method attached to the onSortCmd receives the columnname and a boolean for ascending/descending as arguments.

I think this answers your question.

Thanks,

I know that i receive the columname and sortorder, but i want to disable the sort option for a column,
so if the users clicks the headerlabel, the onSortCmd is not even called.

But i gues that can’t be done.

Regards,

Hans

Just let the custom onSortCmd method you attach to the TableView form do nothing when it’s called for the column you do not want to sort on:

if (x) return;

Paul

Okay, but the user stil gets the impression that a sort is done (the up/down arrow)

I can give him a message, but i would rather disable the option to sort specific columns (disable the label ??),
so the user sees that there is no sort done.

Regards,

Ah, ok, you’re talking about the visual clue the user has that a column is sortable.

No, that is currently not under your control.

Please file a feature request in the support system for this, although how this could be made configurable in the “Servoy” way I have no clue yet.

Paul

Why don’t you simply execute an application.beep() when the user tries to sort an unsortable column? The dear old beep is so disturbing that they will learn very quickly to not click on the sort arrow for that column… ;)

Hi Nicola,

Nice tip !! I think i’ll give it a go.

Thanks and have a nice weekend.

Hans