Skip to content

Instantly share code, notes, and snippets.

@vabarbosa
Last active April 17, 2017 20:44
Show Gist options
  • Save vabarbosa/b0834fa945fea8a1c9265ddbee81c97a to your computer and use it in GitHub Desktop.
Save vabarbosa/b0834fa945fea8a1c9265ddbee81c97a to your computer and use it in GitHub Desktop.
PixieDust Extensibility API - Simple Table Template
from pixiedust.display.display import *
class TestDisplay(Display):
def doRender(self, handlerId):
self._addHTMLTemplateString(
"""
<div>My Simple Table</div>
<table class="table table-striped">
<thead>
{%for field in entity.schema.fields%}
<th>{{field.name}}</th>
{%endfor%}
</thead>
<tbody>
{%for row in entity.take(100)%}
<tr>
{%for field in entity.schema.fields%}
<td>{{row[field.name]}}</td>
{%endfor%}
</tr>
{%endfor%}
</tbody>
</table>
"""
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment