ampproject / amp.dev

The AMP Project Website.
https://amp.dev
Other
582 stars 694 forks source link

Amp-list should support table #2880

Closed timoanttila closed 5 years ago

timoanttila commented 5 years ago

Everything inside amp-mustache will be transformed to list items (div), so I can't open table before it and if I open it in then I have a lot of tables. Also, tr / td inside table should respect width normally (now all the items are like inline-blocks).

I try to make a static page like this https://vlogit.fi/. I have an external JSON for it and amp-list is the only way to use that data. I also have a booking calendar project which needs same feature. I'm using Jekyll and Netlify for static pages.

sebastianbenz commented 5 years ago

The usual workaround for this is to use single-item mode:

  <amp-list layout="fixed-height" height="100"
      src="https://preview.amp.dev/static/samples/json/examples.json"
      binding="no" single-item items=".">
    <template type="amp-mustache">
      <table>  
      {{#items}}
        <tr>
          <td>{{url}}</td>
          <td>{{title}}</td>
        </tr>     
      {{/items}}
      </table>      
    </template>
  </amp-list>

However, this still doesn't seem to work with table. Can you please file a feature request for the AMP runtime here. Thanks!

I'll close this issue here, as this belongs into the runtime repo.

jaygray0919 commented 5 years ago

@sebastianbenz i believe this is related to the same issue we are having here: https://github.com/ampproject/amphtml/issues/23675 the problem occurs even when we use: single-item items="." /cc @cathyxz