Blog

On the DataTables blog you will find news, announcements and tutorials about DataTables and its suite of extensions. New posts are published monthly, with additional news items in between.

16th Jun 2016

Dynamic enum sorting

Ordering of data is a fundamental aspect in any interactive table and it is core to DataTables' ability to let end users easily find the data they are looking for. DataTables has a number of built in ordering types for numbers, currency, dates and strings, but data is complex and it would be impossible for DataTables to define ordering options for all data sets. As such it provides a plug-in interface allowing you to define your own ordering rules for data.

In this post I will introduce a function that will dynamically create ordering and type detection plug-ins for an enumerated list (commonly shortened to enum).

This simple example table shows the use of the plug-in to order the priority column intuitively:

$.fn.dataTable.enum( [ 'High', 'Medium', 'Low' ] );
$('#enum-example').DataTable();
Project Name Priority
Skilled Drill High
Yellow Sleepy Uranium Low
Massive Tungsten Medium
Dusty Scissors High
Big Yard Low
Moving Backpack Low
Risky Cloud Medium

Continue reading...

24th May 2016

Spring updates - 2016

A bit-and-pieces blog post today with information on the latest releases of DataTables software, introducing our new site search and also SpryMedia's first intern!

Continue reading...

25th Mar 2016

Parent / child editing with Editor

When working with data from a database, it is quite a common pattern to use parent / child representations of the data. This allows the end user to select a row in the parent table, then being presented with the associated child data from that record. This interface can be particularly useful when using tables with strong referencing (i.e. joined tables) as it displays a very simple, but powerful and information dense, interface to the end user.

Setting up parent / child editing with Editor is a fairly common question, so in this post I'll detail how it can be done. You'll see here that it can be implemented easily through the use of the DataTables API and events.

In this post I'll use a Sites table as the master table, and a Users table as the child, where each user has a site assigned to them. As we select different rows in the sites table, data will be loaded into the users table as required. Both tables are fully editable and a demonstration of the result is shown below.

Name Users
First name Last name Phone # Location

Continue reading...

Historic blog posts