Tuesday, June 08, 2004

Client-side repeaters

So I've cobbled together some ugly code that I'm pretty sure will die horribly in a non-IE browser. . . (note to self: fix that.)

Ignoring that, it's really neat! It allows for client-size resizing of repeaters - no server trip. The sneaky way I manage this is I mandate the following structure:

TABLE
  THEAD
    TR
       TH Column 1 /TH
       TH Column 2 /TH
       TH Column 3 /TH
     /TR
   /THEAD
   TBODY
     TR
       TD
         TABLE
           --- repeater layout goes here
         /TABLE
       /TD
     /TR
   /TBODY
/TABLE


An n + 1th column is automagically created in the table with add row / delete row buttons. When you press it, it triggers a JavaScript event which detects what table the event came from, finds its parent table, inserts / deletes an appropriate row and then recreates a data entry form using the source as a template strand. See, BIO 139 *did* have a purpose for me!

Anyway, it's quite nice and allows for keeping things client-side, even for really complex repeaters (think, for example, Part 4 of Form 89.)

Comments: Post a Comment



<< Home

This page is powered by Blogger. Isn't yours?