Here's a beginning to understanding how Custom TVs work. My first attempt is a rather simple one, an advanced sortable list of checkboxes for selecting blocks to display in a sidebar.
The bottom line is that while following a couple of rules, you use @INCLUDE <filename> as the input option for the TV, then do whatever you want in the included file. The file really is included, not processed through the eval() function, so it's very efficient. The data can be stored as delimited strings or as JSON-encoded arrays and objects. JQuery (or MooTools or whatever Javascript you prefer) bells and whistles are welcome.
The true value is in creating a class file or library that both the TV and the display snippet use.
Here's the beginning of my efforts, the results of at least four viewings of
chucktrukk's remarkable video tutorials.
http://sottwell.com/custom-tvs.html