>ree told me already that the browsers don't allow to do an innerHTML
>inside a table, but also told me that there is maybe a workaround from
>__gotcha?
>
>Godefroid?;) do you know how to do the browser-innerHTML-table-dance?
>

I do have a browser-innerHTML-table-dance that works on all browsers.
I'm going to give a full example, but I'll keep it short. This is
simplified from a product called Plone4Radio which I'm working on. If
you need the source I'll gladly provide.

Template chart_edit.pt
--------------------------------

  <tal:norender condition="nothing">
      <metal:songrow define-macro="songrow">
        <tr>
          <td tal:content="song/pretty_title_or_id"></td>
        </tr>

        <tr tal:condition="include_placeholder|nothing"
              id="chart-edit-songrow-placeholder">
        </tr>

      </metal:songrow>
    </tal:norender>

    <table class="listing">
          <tr>
            <th>Song</th>
          </tr>
          <tal:songs repeat="song python:here.objectValues('Song')">
            <tal:def define="include_placeholder repeat/song/end"
              <metal:use use-macro="here/chart_edit/macros/songrow"/>
            </tal:def>
          </tal:songs>
    </table>

    <button class="standalone"
                id="chart-edit-add-song">New Song</button>

browser/kss.py
----------------------

     def addSong(self):
        context = aq_inner(self.context)

        newid = context.generateUniqueId('Song')
        context.invokeFactory('Song', newid)
        song = context._getOb(newid)

        # xxx: I have a problem with Plone viewlets for some reason,
so I call the macro
        # with my own evalMacro script (which I do not supply in this posting).
        html = context.evalMacro(
            'chart_edit',
            'songrow',
            song=song,
            include_placeholder=1)

        """
        You'll need to change this code to pass song parameter etc. I don't know
        how to do this right now :(
        html = self.wrapper.render(
            viewMacro = self.macros['live-table-row'],
            )
        """
        ksscore = self.getCommandSet('core')
        selector = ksscore.getHtmlIdSelector('chart-edit-songrow-placeholder')
        ksscore.replaceHTML(selector, html)
        return self.render()

The only problem I see is that I have a placeholder <tr></tr> with NO
td's inside, which is technically a violation of HTML standards.

And if I totally misunderstood what you were trying to accomplish then sorry!

Hedley
_______________________________________________
Kss-devel mailing list
Kss-devel@codespeak.net
http://codespeak.net/mailman/listinfo/kss-devel

Reply via email to