Disable Sort links on Browse Form Headers?

Disable Sort links on Browse Form Headers?

Postby jegalink » Thu Sep 15, 2016 10:22 am

I'm wondering if there's some simple javascript that could do this (i don't know Javascript at all). I want to disable the sort links at the header of each column in the browse form. I'm using WITH ROLLUP in the GROUP BY clause of the SQL statement, so ORDER BY will return an error from MySQL (since the two are mutually exclusive). So if they click any of the header names, the link produces an error since it adds "ORDER BY" to my query.
jegalink
 
Posts: 16
Joined: Tue Feb 10, 2015 2:47 am

Re: Disable Sort links on Browse Form Headers?

Postby jegalink » Thu Sep 15, 2016 7:50 pm

OK, so I KNOW this isn't the most elegant solution, but it works. I'm a php & sql hack, no javascripting background. I placed the following into Custom Code --> Javascript for the Browse form in question. The table of results in this case has five columns, so the following disabled the link at the header of all five columns, but kept the text:
Code: Select all
    document.getElementById('nusort_1').style.pointerEvents = 'none';
    document.getElementById('nusort_2').style.pointerEvents = 'none';
    document.getElementById('nusort_3').style.pointerEvents = 'none';
    document.getElementById('nusort_4').style.pointerEvents = 'none';
    document.getElementById('nusort_5').style.pointerEvents = 'none';
jegalink
 
Posts: 16
Joined: Tue Feb 10, 2015 2:47 am

Re: Disable Sort links on Browse Form Headers?

Postby admin » Tue Sep 27, 2016 11:20 am

jegalink,

Try this...

Code: Select all
$("[id^='nusort']").attr('onclick','');


Steven
admin
Site Admin
 
Posts: 3211
Joined: Mon Jun 15, 2009 9:53 am


Return to General