Re: [IUG] Is there a way... disabling double buttons


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
>>> On 5/12/2011 at 02:21 PM, William Gray <wgray at greenwichlibrary dot org> wrote:
> Assuming there's no switch (maybe there is--I don't know off-hand) the only
> thing I can think of is to programmatically hide the second set of buttons
> (via javascript, probably the easiest way) depending on the height of the
> container containing the result set. So if the containing div of the results
> were to have, say, a height less than 300px, then the div containing the
> second set of buttons would have it's visibility set to "hidden" (or its
> display set to "none", depending on whether or not you want the div to still
> take up space or not in the page flow).

If the point is to only hide the second set of buttons for short tables, it'd probably just be easier to count the number of rows in the patfunc table rather than try to get at the computed height.

Of course setting the visibility of the second set of buttons is made more difficult because they aren't contained in anything like a table row or div and the number of buttons changes with each form will change. Fortunately, there's JQuery:

<script>
var pfrows = $("div#patron_tables table tr").size();
if (pfrows < 5) {
$("div#patron_tables span ~ a").hide();
$("div#patron_tables table ~ a").hide();
};
</script>

We wrap the patfunc token in a div with the ID patron_tables which allows for more precision in the selector. The first selector counts the number of rows in the patfunc table. Then, if that's below a set amount, the next selectors finds all the 'a' tag siblings following the table or span (sometimes the WebPac incorrectly wraps a table in a span) in that div and hides them. It could be that there are other anomalies for the patfunc tables, but I don't have quick access to a patron record that has all of the possible patron function tables. That should be enough to get started, though.

JQuery rules.

HTH,
David




_____________________________________________________________________
David Jones mailto:djones at scu dot edu
Library Systems Manager http://www.scu.edu/library/
University Library fax: 408-551-1805
Santa Clara University phone: 408-551-7167
500 El Camino Real
Santa Clara CA 95053-0500
_____________________________________________________________________
Logic must take care of itself.
-- Wittgenstein, Notebooks, 1914-196, 22.8.14




--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.