2 messages in com.googlegroups.pylons-discussRe: link_to_remote with dynamic targe...
FromSent OnAttachments
Chris Curvey25 Jun 2008 11:30 
Chris Curvey25 Jun 2008 11:37 
Subject:Re: link_to_remote with dynamic target in genshi
From:Chris Curvey (ccur@gmail.com)
Date:06/25/2008 11:37:58 AM
List:com.googlegroups.pylons-discuss

On Jun 25, 2:30 pm, Chris Curvey <ccur@gmail.com> wrote:

(this is not pylons-specific, but I figure someone here will know.)

I would like to be able to use link_to_remote with a dynamic target in genshi.  For example

        <tr py:for="i, up in enumerate(c.unknown_things)">           <td py:content="up.name" />

          <!-- suggestions -->           <td py:with="div_id = 'suggestions_' + str(i)">             ${h.link_to_remote('Suggest', dict(url="/suggest",                                                update="div_id"))}             <div id="${div_id}" />           </td>

          <!-- the form for fixing the mappings -->         </tr>

The idea being that there is a table with one row for each "unknown thing", and each row has a cell containing a link for suggestions. When you click on the link, the "<div>" in the suggestion cell gets populated.

But I can't figure out how to get the "update=" parameter to be evaluated dynamically.

Or is there a better strategy to use?

figured it out (of course, as soon as I exposed my ignorance)

${h.link_to_remote('Suggest', dict(url="/suggest", update=div_id))}

no quotes around "div_id" in the update clause