How to disable sorting a column

If you're a new user of AppGini, feel free to ask general usage questions, or look for answers here.
Post Reply
soewandi
Posts: 17
Joined: 2019-11-20 14:00

How to disable sorting a column

Post by soewandi » 2020-11-06 11:46

As default sorting apply to all column. How to make disable sorting on a column? Thanks for your help.

pbottcher
AppGini Super Hero
AppGini Super Hero
Posts: 1635
Joined: 2018-04-01 10:12

Re: How to disable sorting a column

Post by pbottcher » 2020-11-06 11:54

Hi,

set

Code: Select all

$options->AllowSorting=0; 
in the init function of your table within the hooks dir,
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.

User avatar
jsetzer
AppGini Super Hero
AppGini Super Hero
Posts: 1807
Joined: 2018-07-06 06:03
Location: Kiel, Germany
Contact:

Re: How to disable sorting a column

Post by jsetzer » 2020-11-06 12:02

What about these code fragments for hooks/TABLENAME-tv.js inside $j(document).ready(function(){...});:

Disable sorting in TV for all columns:

Code: Select all

    $j("a.TableHeader").each(function () { $j(this).parent().text($j(this).text()) });
Disable sorting in TV for one column:

Code: Select all

    let cn = "subject"; // column name
    $j("th." + AppGini.currentTableName() + "-" + cn + " > a.TableHeader").each(function () { $j(this).parent().text($j(this).text()) });
Kind regards,
<js />

My AppGini Blog:
https://appgini.bizzworxx.de/blog

You can help us helping you:
Please always put code fragments inside [code]...[/code] blocks for better readability

AppGini 24.10 Revision 1579 + all AppGini Helper tools

soewandi
Posts: 17
Joined: 2019-11-20 14:00

Re: How to disable sorting a column

Post by soewandi » 2020-11-06 13:25

Mr Jan, you always make AG user smiling. Many thanks.

User avatar
jsetzer
AppGini Super Hero
AppGini Super Hero
Posts: 1807
Joined: 2018-07-06 06:03
Location: Kiel, Germany
Contact:

Re: How to disable sorting a column

Post by jsetzer » 2020-11-06 13:36

Thank you for your nice and friendly words :)
Kind regards,
<js />

My AppGini Blog:
https://appgini.bizzworxx.de/blog

You can help us helping you:
Please always put code fragments inside [code]...[/code] blocks for better readability

AppGini 24.10 Revision 1579 + all AppGini Helper tools

soewandi
Posts: 17
Joined: 2019-11-20 14:00

Re: How to disable sorting a column

Post by soewandi » 2020-11-10 11:50

Disable sorting column on parent table is OK. Now, how to disable sorting column on children table? Thanks in advanced for your help.

pbottcher
AppGini Super Hero
AppGini Super Hero
Posts: 1635
Joined: 2018-04-01 10:12

Re: How to disable sorting a column

Post by pbottcher » 2020-11-10 18:37

And again, see my post :-)
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.

User avatar
jsetzer
AppGini Super Hero
AppGini Super Hero
Posts: 1807
Joined: 2018-07-06 06:03
Location: Kiel, Germany
Contact:

Re: How to disable sorting a column

Post by jsetzer » 2020-11-10 19:36

I think soewandi was and is asking about disabling sorting for ONE column, not for the whole table. But perhaps I did not understand his question right.
Kind regards,
<js />

My AppGini Blog:
https://appgini.bizzworxx.de/blog

You can help us helping you:
Please always put code fragments inside [code]...[/code] blocks for better readability

AppGini 24.10 Revision 1579 + all AppGini Helper tools

soewandi
Posts: 17
Joined: 2019-11-20 14:00

Re: How to disable sorting a column

Post by soewandi » 2020-11-11 03:41

Yes, I mean disable sorting on one or more column. Disable all column from project setting.

soewandi
Posts: 17
Joined: 2019-11-20 14:00

Re: How to disable sorting a column

Post by soewandi » 2020-11-30 09:36

May I ask again? I've tried to find solution by myself but get nothing. So, how to disable sorting column (all column) on children table? Thanks in advanced for your help.

User avatar
jsetzer
AppGini Super Hero
AppGini Super Hero
Posts: 1807
Joined: 2018-07-06 06:03
Location: Kiel, Germany
Contact:

Re: How to disable sorting a column

Post by jsetzer » 2020-11-30 10:09

Simple solution as a starting point for your own development. Briefly tested but not tested for all scenarios:

In hooks/TABLENAME-dv.js each time your children tab tables have been (lazy-) loaded* ...

Code: Select all

$j("th[onclick][onclick!='']").attr("onclick", null).css("cursor", "unset");
* Attention: this implicitly means that you have to do this also after a refresh of the children-tab table. This implicitly means you will have to do this also after creating a new record (which forces a reload automatically).

Before
chrome_XMOfYZ7P2T.png
chrome_XMOfYZ7P2T.png (2.72 KiB) Viewed 3989 times

After
sCacdQy4p3.png
sCacdQy4p3.png (2.31 KiB) Viewed 3989 times

Note that I have not only removed the link but also unset the "hand"-cursor. The sorting-icon remains according to the configured sorting in your project.
Kind regards,
<js />

My AppGini Blog:
https://appgini.bizzworxx.de/blog

You can help us helping you:
Please always put code fragments inside [code]...[/code] blocks for better readability

AppGini 24.10 Revision 1579 + all AppGini Helper tools

soewandi
Posts: 17
Joined: 2019-11-20 14:00

Re: How to disable sorting a column

Post by soewandi » 2020-11-30 10:40

Thank you Mr Jan for your time. I've tried but still sorting. Actually, how to disable all function of Child Table, including sorting, updating or inserting if a condition demand of that. Where do I can find information about Child Table?

Post Reply