Page 1 of 1

How to disable sorting a column

Posted: 2020-11-06 11:46
by soewandi
As default sorting apply to all column. How to make disable sorting on a column? Thanks for your help.

Re: How to disable sorting a column

Posted: 2020-11-06 11:54
by pbottcher
Hi,

set

Code: Select all

$options->AllowSorting=0; 
in the init function of your table within the hooks dir,

Re: How to disable sorting a column

Posted: 2020-11-06 12:02
by jsetzer
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()) });

Re: How to disable sorting a column

Posted: 2020-11-06 13:25
by soewandi
Mr Jan, you always make AG user smiling. Many thanks.

Re: How to disable sorting a column

Posted: 2020-11-06 13:36
by jsetzer
Thank you for your nice and friendly words :)

Re: How to disable sorting a column

Posted: 2020-11-10 11:50
by soewandi
Disable sorting column on parent table is OK. Now, how to disable sorting column on children table? Thanks in advanced for your help.

Re: How to disable sorting a column

Posted: 2020-11-10 18:37
by pbottcher
And again, see my post :-)

Re: How to disable sorting a column

Posted: 2020-11-10 19:36
by jsetzer
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.

Re: How to disable sorting a column

Posted: 2020-11-11 03:41
by soewandi
Yes, I mean disable sorting on one or more column. Disable all column from project setting.

Re: How to disable sorting a column

Posted: 2020-11-30 09:36
by soewandi
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.

Re: How to disable sorting a column

Posted: 2020-11-30 10:09
by jsetzer
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 5188 times

After
sCacdQy4p3.png
sCacdQy4p3.png (2.31 KiB) Viewed 5188 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.

Re: How to disable sorting a column

Posted: 2020-11-30 10:40
by soewandi
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?