{ "info": { "author": "4teamwork AG", "author_email": "mailto:info@4teamwork.ch", "bugtrack_url": null, "classifiers": [ "Framework :: Plone", "Framework :: Plone :: 4.3", "Framework :: Plone :: 5.1", "Programming Language :: Python", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "Introduction\n============\n\nThe `ftw.table` package provides a utility for generating HTML tables of\ndicts, catalog brains and other objects.\n\nIt comes with a jQuery plugin installable with a Plone Generic Setup profile,\nproviding features such as sorting, filter, grouping checkboxes and more.\n\n\nPurpose\n-------\n\nThe main purpose of this library package is to abstract the table generation\nfor the `ftw.tabbedview`_ package but it can also be used in a plain\nplone / zope installation.\n\n\nTable generator utility\n-----------------------\n\nThe table generator utility can generate HTML or JSON output.\nIt expects a list of data objects, accessible either in dict-like syntax by\nusing ``item.get(attrname)`` or in a object-like syntax by using\n``item.attrname``.\nIt also expects a column configuration indicating which columns / attributes\nare displayed in the table and how they are presented.\n\nExamples:\n\n >>> from ftw.table.interfaces import ITableGenerator\n >>> from zope.component import getUtility\n >>>\n >>> generator = getUtility(ITableGenerator, name=\"ftw.tablegenerator\")\n >>>\n >>> data = [\n ... {'id': 1,\n ... 'name': 'Ptolemy I Soter',\n ... 'dates': '305-285 BC',\n ... },\n ... {'id': 2,\n ... 'name': 'Ptolemy II Philadelphos',\n ... 'dates': '288-246 BC',\n ... }]\n >>>\n >>> columns = ['id', 'name', 'dates']\n >>> print generator.generate(data, columns)\n
| \n id\n | \n\n name\n | \n\n dates\n | \n
|---|---|---|
| \n 1\n | \n\n Ptolemy I Soter\n | \n\n 305-285 BC\n | \n
| \n 2\n | \n\n Ptolemy II Philadelphos\n | \n\n 288-246 BC\n | \n