-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Content incorrectly rendered inside table. #503
Comments
Perhaps this is something to do with #266. |
Tables are really tricky to work with because they have all sorts of rules around what kinds of elements they'll display. Right now a But if you extend <polymer-element name="fancy-table" extends="table" noscript>
<template>
<thead>
<tr>
<th>Name</th>
<th>Age</th>
<th>Food</th>
</tr>
</thead>
<content></content>
</template>
</polymer-element>
<polymer-element name="fancy-body" extends="tbody" attributes="players">
<template>
<!-- Using special tr style template. Not required in this case, but saves a few lines :) -->
<!-- http://www.polymer-project.org/resources/faq.html#option-tr -->
<tr template repeat="{{player in players}}">
<td>{{player.name}}</td>
<td>{{player.age}}</td>
<td>{{player.food}}</td>
</tr>
</template>
<script>
Polymer('fancy-body', {
players: [] // type hinting for Polymer so it knows to treat as Array
});
</script>
</polymer-element> I tried initially extending Since we're extending elements, we have to use type-extension syntax. <table is="fancy-table">
<!-- Note: players is using valid JSON style quotation. -->
<tbody is="fancy-body"
players='[{"name": "Rob", "age": 30, "food": "sushi"}, {"name": "Boris", "age": 50, "food": "pizza"}]'>
</tbody>
</table> Here's an example: Hope that helps! |
That looks good Rob, thanks a lot! 😸 |
One additional thought is that if you want to render a list of players, you don't need to have a separate element for the tbody, you could put the This approach puts all of the table components in the same shadow DOM tree, which is a little simpler to style. |
That's exactly what I was just thinking 😄 On 17 May 2014 00:11, Arthur Evans [email protected] wrote:
|
Hi, I'm trying to get some content to load inside a table, but it doesn't seem to work. I think maybe I should be extending tags such as
tr
andtable
rather than what I'm doing.index.html
badsey-player.html
badsey-table.html
Rendered HTML
The text was updated successfully, but these errors were encountered: