<-- click here
One button, one function, one class name . . .. . . no style sheets, no frameworks, no Adobe, no Silverlight, no HTML5, no baggage!
What does this have to do with SQL Anywhere?For you, maybe nothing, maybe a lot, more on that later.
But first, the code:
- The var trs on line 3 creates an array filled by calling the builtin getElementsByClassName() function which returns all the HTML elements on the page that have class="showHideTr".
- The CSS class="ShowHideTr" attribute is specified for all the TR elements that are used to show child rows; i.e, lines 22 and 23, 25 and 26, etc.
- There's no actual CSS class selector definition for the "ShowHideTr" class, it's just a name given to a bunch of TR elements so that getElementsByClassName() can find them all.
- The rest of the code on lines 4 through 16 serves to switch the CSS display property between "none" and "table-row" (normal for a TR), as well as switching the button's visible value between "Hide" and "Show".
What about SQL Anywhere?SQL Anywhere's builtin HTTP server can be used to directly display tables and rows via HTML, and sometimes the amount of data can be overwhelming, hence the desire for a "show hide" button.
OK, ok, it's all about Foxhound :)... the new Connection History page shows all the data collected for one connection every 10 seconds, including the SQL statement and the execution plan, and the result is the very definition of "overwhelming":
Sure, it's got "Show More / Show Less" buttons on the Last Statement and Last Plan Text lines, but it needs another button to make those lines disappear altogether: