DataTables Blog http://www.datatables.net/blog en-us Tutorials and news about DataTables Locale based sorting Let's stereotype for a moment: developers whose first (and in many cases, such as my own, only) language is English, don't always appreciate localisation issues to the degree we should. With people using DataTables all over the world (68 community translations for DataTables core) this is something that I'm very aware of as a library developer.

While DataTables offers options for localisation of the text it uses, we also need to consider the data that the table contains. Sorting is one area where this has proven to be particularly difficult to get right, but fortunately with new Javascript APIs that are now available in browsers, we can get locale based sorting absolutely right every time.

Also, don't make the mistake of thinking that this post is only for developers who are working in languages other than English - the sorting options made available by the Intl API offer something for everyone!

Continue reading...

]]>
Tue, 28 Feb 2017 13:18:00 GMT http://www.datatables.net/blog/2017-02-28 http://www.datatables.net/blog/2017-02-28
Search highlighting with mark.js

Contributed post

This post has been written by Julian Motz, the author of mark.js and discusses the integration options between DataTables and his search highlighting library, providing far more functionality than the program developed in my original post on this topic.

If you're googling for DataTables or any other keyword you'll notice that the search keyword will be highlighted in the description of each result. This behaviour allows users to find what they're searching for more faster and therefore leads to a better usability.

DataTables itself offers a search feature that filters a table to only show relevant rows. But it doesn't offer built-in keyword highlighting within these results. If you'd like to improve the usability for your users too, keep on reading.

Continue reading...

]]>
Thu, 19 Jan 2017 12:00:00 GMT http://www.datatables.net/blog/2017-01-19 http://www.datatables.net/blog/2017-01-19
Sorting with absolute positioned data The ordering of information in a DataTable is probably the aspect that I cover most in this blog (enums and dates for example, and more to come), but that is because it such a rich topic! DataTables is used in a wide range of applications from space telescope telemetry to amateur football leagues, so it needs to be able to cope with lots of different data types. DataTables core ships with just a basic set of data sorting functions (string, number, currency, percentage, ISO8601 dates) so, for anything outside of this range DataTables provides a sorting plug-in API that you can use to define your own sorting methods.

Typically with a sorting method you would have linear ordering, whereby the descending sort is the exact reverse of ascending, and everything is ordered by a simple comparison (numeric or character code points). This post is going to be a little different: I'll introduce a non-linear configurable sorting plug-in, whereby you can keep specific pieces of data at the top or the bottom of a column, regardless of the sorting direction and the value of that item.

An example is always worth a million words, so let's consider the following table:

Name Position Office Start date Salary
Tiger Nixon System Architect Edinburgh 2011/04/25 $320,800
Garrett Winters Accountant Tokyo 2011/07/25 $170,750
Ashton Cox Junior Technical Author San Francisco 2009/01/12 $86,000
Unknown Senior Javascript Developer Edinburgh 2012/03/29 TBC
Airi Satou Accountant Tokyo 2008/11/28 $162,700
Brielle Williamson Integration Specialist New York 2012/12/02 $372,000
Unknown Sales Assistant San Francisco 2012/08/06 TBC
Rhona Davidson Integration Specialist Tokyo 2010/10/14 $327,900
Colleen Hurst Javascript Developer San Francisco 2009/09/15 Not available
Sonya Frost Software Engineer Edinburgh 2008/12/13 $103,600

In this case we have two columns where absolute ordering can be useful:

  • Name column where there are "Unknown" entries that should be shown at the top of the table.
  • Salary column where "TBC" should be shown at the top and "Not available" should be shown at the bottom.

If you alter the sorting that is applied to the table by clicking on the headers of those columns, you will be able to see that those items stay in position regardless of the sorting of the column. If sorting is applied to one of the other columns the rows will be sorted normally.

Continue reading...

]]>
Fri, 23 Dec 2016 12:00:00 GMT http://www.datatables.net/blog/2016-12-22 http://www.datatables.net/blog/2016-12-22
Editor 1.6 I'm very pleased to announce the release of Editor 1.6, the sixth major update to Editor in its 1.x series. It is a free upgrade to all existing license holders and adds a number of exciting new features that greatly increase Editor's capabilities, particularly on the client-side.

In this post I'll run through a summary of the new features in 1.6 and in future posts explore how we can utilise them to enhance the applications developed with Editor further.

Editor 1.6 can be downloaded from its download page as both a free trial if you haven't tried Editor out yet, or if you have a license, the fully licensed version will automatically be downloaded.

Continue reading...

]]>
Fri, 16 Dec 2016 12:05:00 GMT http://www.datatables.net/blog/2016-12-15 http://www.datatables.net/blog/2016-12-15