Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
15
Erster Beitrag:
vor 4 Jahren, 5 Monaten
Letzter Beitrag:
vor 4 Jahren, 5 Monaten
Beteiligte Autoren:
Michael Drechsel, GuenterP, Al, David Egan, Piet van Zanten

[WD17] Filter on table header- how to switch them off ?

Startbeitrag von Michael Drechsel am 07.11.2013 13:28

Hi,

If the user click on a table header the column is sorted. But how can I switch this off ?
Another click change the sort direction .. CTRL+Click or ALT+CTRL+Click doesn´t work

Any ideas ?

Antworten:

Hi Michael
In the definition of the column simply uncheck the sortable option.

Cheers

David

von David Egan - am 07.11.2013 18:29
Hi David'

I mean at runtime.

von Michael Drechsel - am 07.11.2013 18:42
Hello Michael

..sortable will turn column sorting on or off in code

Regards
Al

von Al - am 07.11.2013 20:37
Hi Al,

I am searching for a hint how the end user could switch off the little arrow in the table header.

von Michael Drechsel - am 07.11.2013 21:08
Hi Michael,

I'm a bit confused, why would the user want to switch off the little arrow?
Anyway, you can use the "whenever sorted" code of the column to do whatever you want (bottom left corner of the column code).

Regards,
Piet

von Piet van Zanten - am 07.11.2013 22:22
Hello Michael

When you set the ..sortable option to false, it removes the arrow icon.

Regards
Al

von Al - am 07.11.2013 23:00
Hi,

ok, let me explain:

I use a query with a special sort over 4 fields and display it in a table. If the user click on the table header my sort is destroyed. He wants to recover this. So I thought there is an (for me) unknown key combination that brings the original table sort back without programming.

von Michael Drechsel - am 08.11.2013 06:10
Hello Michael

When I need to restore a pre-defined sort order for table columns I have two basic methods.

If there is only one sort pattern, I have a button near the table that the user clicks to resort the table.
If I offer a range of pre-defined sort patterns then they are displayed in a combo box and the user selects the most appropriate.

In V18 there is an option for the user to save sorts so that may also be an option for you to look at if it is available in V17.


Regards
Al

von Al - am 08.11.2013 06:45
Quote
Michael Drechsel
Hi,

ok, let me explain:

I use a query with a special sort over 4 fields and display it in a table. If the user click on the table header my sort is destroyed. He wants to recover this. So I thought there is an (for me) unknown key combination that brings the original table sort back without programming.


Hi Michael, there's a code snippet somewhere in the Help System
http://doc.pcsoft.fr/en-US/?1013288&name=programming_the_table_columns&q=column%20header%20click%20event
which catches the event when clicking the header of a certain column. There it is where you can initiate the more or less complex sort of the column as it had been before. You can even use a variable to switch between ascending and descending sort direction. It is a frequently encountered problem that sorting of one or more columns isn't as simple as just sorting. You can use hidden columns to help with the sort operation, in such cases usually, when loading the Table control I add a hidden column that contains a concatenated string with the real sort field. Whenever the user clicks the header of the column in question, in reality I let it do the sort by this hidden column.

von GuenterP - am 08.11.2013 07:29
Hi @ all,

thx for the answers. Let me consider:

1. If the user clicks at a table header HE has no possibility to remove this sorting out of the box.

2. There are many ways to program something (which I should do now)

von Michael Drechsel - am 08.11.2013 09:05
Hi Michael,
you're right, there's no AAF for removing the sort option of a column! Imho, if you're changing the behaviour of the column by software anyway, there's no need to remove the sort indicator.

von GuenterP - am 08.11.2013 10:18

Re: [WD17] Filter on table header- how to switch them off ? [SOLVED]

Hi,

its so easy (and I don´t know why PCS has no AAF Menu option)

A simple

tablesort(mytable,false)


does the trick.

von Michael Drechsel - am 08.11.2013 11:08

Re: [WD17] Filter on table header- how to switch them off ? [SOLVED]

Hi, you could add that to the system menue, no problem!

von GuenterP - am 08.11.2013 12:03

Re: [WD17] Filter on table header- how to switch them off ? [SOLVED]

I did it ...

von Michael Drechsel - am 08.11.2013 12:22
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.