Em Sunday 07 September 2008 13:16:31 Ben Sizer escreveu:
>
> Example: I have a GridOfNumbers widget, which displays several columns
> of numbers. In addition to the numbers, it also takes a display_type
> parameter (integer, ranging from 1 to 3) that specifies how I want to
> show those numbers. Imagine also I have 3 corresponding functions -
> number_as_digits(), number_as_roman_numerals(),
> number_as_english_words() - each taking an int and returning a string.
> The idea is that the widget filters all output through one of these 3
> functions, based on the display_type parameter provided.

Degradation apart, I'd make this using JavaScript.  Probably some AJAX if you 
already have everything in place on the controller... 

> The data could be pre-processed in the controller, but this is purely
> about presentation, so the controller is the wrong place for this.
> This functionality should be in the template, or the widget.

The controller can supply all alternatives.

If you change the option, reload the page (on non-JS enabled cases) or use 
AJAX to replace the option.

You provide all alternatives as result from the controller and let the 
template choose which one to show (so that this works without JS).


-- 
Jorge Godoy      <[EMAIL PROTECTED]>


Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to