I've seen requests for this type of plugin frequently - I'd be interested in seeing a demo of this combined with the tablesorter plugin: http://tablesorter.com/ - that would make for a truly impressive demonstration.
One quick item: I noticed that when I collapsed a parent item, all child items also became collapsed, which seems a little weird. Great work! --John On 8/16/07, PaulHan <[EMAIL PROTECTED]> wrote: > > Hi all, > Hope this hasn't come out twice, if it has, apologies. > > I needed a treetable for a project I'm doing, but nothing I had seen > quite fitted the bill, so I made my own, and then adapted it so it > could be used as a plugin. This is my first plugin, so be kind, any > help making it more efficient/jquery-like would be most appreciated. > Basically, you build an ordinary html table with the styling you want. > You wrap a single tbody around the rows you want to have expanding/ > collapsing and give it a class or id, as this is the selector that > will be used by jQTreeTable. This way, if javascript is disabled, > visitors still get the plain table. Then you set up a one dimensional > array of parents for each row. The length of this will be the same as > are rows in the tbody. For the purposes of mapping the parents, the > first row is row 1 (not 0), and corresponds to the first item in the > array. The top level items in the tree have a parent of 0, with the > rest having their immediate parent's row number as their entry in the > array. You'll be able to see all this on the demo page [Link below]. > You then set the options you would like, like the images for open and > closed states, which nodes you want initially collapsed, what column > you would like to have the treeview effect. There are already defaults > for these options. You feed this hash and array into the jQTreetable > plugin and it takes it from there. It can also be set up as just a > treeview, by making a one column table, although you are probably > better off using Jorn's treeview based on lists if that's all you want > to do, as it is probably better performance-wise and definitely better > effects-wise. I tried this with a 500 node treetable, which took a > couple of seconds to load, probably because of all the randomly > generated content, but there didn't seem to be any noticeable degrade > in the opening/closing of nodes. If your mileage varies, let me know. > It's only been tested in IE7 and Firefox, although I don't expect too > many issues as I used very simple CSS swapping for the effect. > Feature requests and bug reports are welcome, although feature > requests may take some time, as I'd like to wait and see if I can > adapt it to some work that some very clever coders over at jQuery UI > are doing. The link to it is <a href="http://www.hanpau.com/jquery/ > unobtrusivetreetable.php">http://www.hanpau.com/jquery/ > unobtrusivetreetable.php</a> > > Just hope it will be useful to people. > > Regards, > > Paul. > >