N. Arakawa wrote:
> I often make a data-table view, which links to similar views with
> small parameter changes, such as paging or sorting order.
>
> In this case, making a link URI based on 'delta' information is handy.
>
> In Application Code:
>   sub uri_delta{
>     my($self,@arg)[EMAIL PROTECTED];
>     if (@arg % 2 != 0){
>       $self->log->error("Odd elements for a hash!");
>       return "Odd elements for a hash!";
>     }else{
>       my %new_param = (%{$self->request->parameters}, @arg);
>    # Which is better, 'parameters' or 'query_parameters' ?
>       return $self->uri_for($self->action,\%new_param);
>     }
>   }
>
> In TT-Template:
>  <a href="[% Catalyst.uri_delta('page', prev); %]">&larr;</a>
>
> There is at least one drawback of this approach:
>  it is not possible to 'delete' a parameter.
> However, assign 'undef' instead of deleting  parameter often enough.
>
>   
Is this any different than $c->req->uri_with()?

-Brian

_______________________________________________
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/

Reply via email to