Thanks Ben, great answer.

The "modern" Web2.0 version is to render the entire blank table and rest
of page as the first request and then use JavaScript to fill in each
cell. 
  This might not answer the original post's problem, since it requires
more than just format change serverside, but doesn't require paginating,
just passing the data as XML or JSON separate from format.

This has network overhead (HTTP roundtrip per JS request) but gives
users something to see.  One could use one of the JSON modules on CPAN
to generate the replies, or even a single big XML/JSON reply that maps
to the whole table, and some nice JS routine parses and stuffs
cell-per-cell for you.  Easiest would be a CPAN module that matches a JS
library so you have browserside support. Haven't played with that yet.

In a similar vein, but very minimalist, my page
http://ema.arrl.org/fd/history/analysis.html initially renders a generic
background and then replaces it with a (pre-computed) graph requested in
the form.  After page finishes render, onload="change_pix(); picks up
the default values in theform's pulldowns and changes it.  No JSON
marshalling or parsing is required since graphics are offline computed
with Perl Imager, Text::CSV, and Treemap (as seen on Perl Advent
Calendar http://perladvent.pm.org/2006/3/ ),so JS just computes compound
name of selected statistical graphic.

In codesample below, FD2002-pin.gif is the initial "blank" background,
forcibly scaled to the size of the real graphs.


<script>
<!--

 function change_pix() 
 {
 var a_file = "data/fd_"
   +theform.year.value+"_"
   +theform.where.value+"_"
   +theform.how.value+".png";

  var caption_str = "Analysis for "+theform.where.value+" in
"+theform.year.value+" by "+theform.how.value;

 document.getElementById("caption").innerHTML =  caption_str;
 document.getElementById("treemap").src       = a_file

 return;
 }


-->
</script>
...
<BODY onload="change_pix();">
...
<img name="treemap" id="treemap" src="FD2002-pin.gif" width="800"
height="600">


[This JS code is not from $DayJob but from EMA.ARRL.ORG volunteer work
and the Perl Advent Calendar. (The Perl code was reused for a POC at
$DayJob too.)]



_______________________________________________
Boston-pm mailing list
[email protected]
http://mail.pm.org/mailman/listinfo/boston-pm

Reply via email to