Title: DataTables plug-in

This plug-in uses the DataTables jQuery plug-in to offer a new kind of widget. If you're a developer, this plug-in also offers you a way to include your own DataTable widgets in a TeamPage plug-in.



Download



(Note: starting with version 6.2.30, TeamPage's installers now automatically install this plug-in.)



DataTables Widget



How to insert a widgetYou can easily insert a DataTable as a widget into any entry.



Click the Insert Widget icon in the toolbar and select "DataTables" in the widgets list.

Select the widget

After filling in the form, click "OK" to insert the widget.

Insert

The widget will appear when you save the entry.



The controls at the top of the table offer easy sorting and filtering.

Filter Example

Widget Options



To filter the entries displayed in the table, you can specify one or more entry type names, and a search expression.

For example, to display just task entries, you could specify "task" for the entry type filter; or x(task) for the search expression.

Show tasks only

To indicate what columns you'd like to display, you can type the names of the "entry fields" that you want to see. In this example, we're displaying the Traction ID, Title, Submission Date/Time, Author Name, Task Priority, and Due Date.

Columns

The following options are available:



Table Styles



You can control the visual appearance of the table by selecting one or more styles:



Page Length and Length Menu





Column Control



When Column Control (usedtcc) is enabled, each column header gets a dropdown panel for filtering and sorting. You can choose which items appear in the panel using dtccfields (options: search, spacer, orderAsc, orderDesc, orderClear).

Column Search



When show_columnsearch is enabled (the default), a search box appears below each column header, allowing per-column filtering.

State Save



When state_save is enabled (the default), the DataTable remembers the user's sort order, filter, and page between visits.

Server-Side Processing



When serverside is enabled, paging, global search, and sorting are handled by the server on each request rather than loading all rows at once into the browser. This is recommended for large data sets. See "Server-Side Processing" below.

Export and Display Buttons





Sum Footer



sum — Specify a comma-separated list of column index numbers (starting from 0) to show a sum total in the table footer.

For example, sum=2,3 shows the sum of columns 3 and 4. Note: unavailable when show_columnsearch is enabled, as the footer area is used for the column search boxes.

For Developers: DataTables Library



Usage (1) - An example view



Load the "datatables_example" view by entering /type datatables_example into TeamPage's search box, and pressing enter. Here you can experiment by changing the values of the parameters.

Example View

Usage (2) - with a Section Title



This plug-in supports showing the results of a section in a DataTable, with HTML and styles similar to those of a section table widget.

To display this widget in an IFRAME, you can invoke the parent.sdl's "datatable-section" function like this:

<com.traction.sdl.datatables.parent#datatable-section id="foo" proj="*" ... />


Usage (3) - without a Section Title



To display a similar widget but without a section title, instead use the "datatable-iframe-div" function, like this:

<com.traction.sdl.datatables.parent#datatable-iframe-div id="foo" proj="*" ... />


Parameters



These functions require the following variables:



The following variables are optional, or may be conditionally required depending upon the value specified by the "entries_type" variable.



Server-Side Processing



By default, the DataTable loads all matching entries in a single request and handles paging, searching, and sorting entirely in the browser. For large data sets this can be slow.

When serverside=true, the table fetches only one page of entries per request, and the server handles paging, global text search, and sorting on each interaction.

Limitations in server-side processing mode:



When serverside=true, the max parameter is ignored — the server returns exactly the number of rows requested by the DataTable's page length per request.



Attachments:
example_of_the_example_view.png
widget1.png
widget2.png
widget3.png
widget4.png
widgetoption_task.png
widgetoption_entries_type.png
Related Articles
Article: Forum6642 (permalink)
Categories: :Doc:plug-in
Date: June 5, 2016; 4:58:35 PM Eastern Daylight Time

Author Name: Takashi Okutsu
Author ID: takashi