diff --git a/examples/ajax/data/orthogonal.txt b/examples/ajax/data/orthogonal.txt new file mode 100644 index 00000000..eb378c3f --- /dev/null +++ b/examples/ajax/data/orthogonal.txt @@ -0,0 +1,631 @@ +{ + "data": [ + { + "name": "Tiger Nixon", + "position": "System Architect", + "salary": "$3,120", + "start_date": { + "display": "Mon 25th Apr 11", + "timestamp": "1303682400" + }, + "office": "Edinburgh", + "extn": "5421" + }, + { + "name": "Garrett Winters", + "position": "Director", + "salary": "$5,300", + "start_date": { + "display": "Mon 25th Jul 11", + "timestamp": "1311544800" + }, + "office": "Edinburgh", + "extn": "8422" + }, + { + "name": "Ashton Cox", + "position": "Technical Author", + "salary": "$4,800", + "start_date": { + "display": "Mon 12th Jan 09", + "timestamp": "1231714800" + }, + "office": "San Francisco", + "extn": "1562" + }, + { + "name": "Cedric Kelly", + "position": "Javascript Developer", + "salary": "$3,600", + "start_date": { + "display": "Thu 29th Mar 12", + "timestamp": "1332972000" + }, + "office": "Edinburgh", + "extn": "6224" + }, + { + "name": "Jenna Elliott", + "position": "Financial Controller", + "salary": "$5,300", + "start_date": { + "display": "Fri 28th Nov 08", + "timestamp": "1227826800" + }, + "office": "Edinburgh", + "extn": "5407" + }, + { + "name": "Brielle Williamson", + "position": "Integration Specialist", + "salary": "$4,525", + "start_date": { + "display": "Sun 2nd Dec 12", + "timestamp": "1354402800" + }, + "office": "New York", + "extn": "4804" + }, + { + "name": "Herrod Chandler", + "position": "Sales Assistant", + "salary": "$4,080", + "start_date": { + "display": "Mon 6th Aug 12", + "timestamp": "1344204000" + }, + "office": "San Francisco", + "extn": "9608" + }, + { + "name": "Rhona Davidson", + "position": "Integration Specialist", + "salary": "$6,730", + "start_date": { + "display": "Thu 14th Oct 10", + "timestamp": "1287007200" + }, + "office": "Edinburgh", + "extn": "6200" + }, + { + "name": "Colleen Hurst", + "position": "Javascript Developer", + "salary": "$5,000", + "start_date": { + "display": "Tue 15th Sep 09", + "timestamp": "1252965600" + }, + "office": "San Francisco", + "extn": "2360" + }, + { + "name": "Sonya Frost", + "position": "Software Engineer", + "salary": "$3,600", + "start_date": { + "display": "Sat 13th Dec 08", + "timestamp": "1229122800" + }, + "office": "Edinburgh", + "extn": "1667" + }, + { + "name": "Jena Gaines", + "position": "System Architect", + "salary": "$5,000", + "start_date": { + "display": "Fri 19th Dec 08", + "timestamp": "1229641200" + }, + "office": "London", + "extn": "3814" + }, + { + "name": "Quinn Flynn", + "position": "Financial Controller", + "salary": "$4,200", + "start_date": { + "display": "Sun 3rd Mar 13", + "timestamp": "1362265200" + }, + "office": "Edinburgh", + "extn": "9497" + }, + { + "name": "Charde Marshall", + "position": "Regional Director", + "salary": "$5,300", + "start_date": { + "display": "Thu 16th Oct 08", + "timestamp": "1224108000" + }, + "office": "San Francisco", + "extn": "6741" + }, + { + "name": "Haley Kennedy", + "position": "Senior Marketing Designer", + "salary": "$4,800", + "start_date": { + "display": "Tue 18th Dec 12", + "timestamp": "1355785200" + }, + "office": "London", + "extn": "3597" + }, + { + "name": "Tatyana Fitzpatrick", + "position": "Regional Director", + "salary": "$2,875", + "start_date": { + "display": "Wed 17th Mar 10", + "timestamp": "1268780400" + }, + "office": "London", + "extn": "1965" + }, + { + "name": "Michael Silva", + "position": "Senior Marketing Designer", + "salary": "$3,750", + "start_date": { + "display": "Tue 27th Nov 12", + "timestamp": "1353970800" + }, + "office": "London", + "extn": "1581" + }, + { + "name": "Paul Byrd", + "position": "Javascript Developer", + "salary": "$5,000", + "start_date": { + "display": "Wed 9th Jun 10", + "timestamp": "1276034400" + }, + "office": "New York", + "extn": "3059" + }, + { + "name": "Gloria Little", + "position": "Systems Administrator", + "salary": "$3,120", + "start_date": { + "display": "Fri 10th Apr 09", + "timestamp": "1239314400" + }, + "office": "New York", + "extn": "1721" + }, + { + "name": "Bradley Greer", + "position": "Software Engineer", + "salary": "$3,120", + "start_date": { + "display": "Sat 13th Oct 12", + "timestamp": "1350079200" + }, + "office": "London", + "extn": "2558" + }, + { + "name": "Dai Rios", + "position": "System Architect", + "salary": "$4,200", + "start_date": { + "display": "Wed 26th Sep 12", + "timestamp": "1348610400" + }, + "office": "Edinburgh", + "extn": "2290" + }, + { + "name": "Jenette Caldwell", + "position": "Financial Controller", + "salary": "$4,965", + "start_date": { + "display": "Sat 3rd Sep 11", + "timestamp": "1315000800" + }, + "office": "New York", + "extn": "1937" + }, + { + "name": "Yuri Berry", + "position": "System Architect", + "salary": "$3,600", + "start_date": { + "display": "Thu 25th Jun 09", + "timestamp": "1245880800" + }, + "office": "New York", + "extn": "6154" + }, + { + "name": "Caesar Vance", + "position": "Technical Author", + "salary": "$4,965", + "start_date": { + "display": "Mon 12th Dec 11", + "timestamp": "1323644400" + }, + "office": "New York", + "extn": "8330" + }, + { + "name": "Doris Wilder", + "position": "Sales Assistant", + "salary": "$4,965", + "start_date": { + "display": "Mon 20th Sep 10", + "timestamp": "1284933600" + }, + "office": "Edinburgh", + "extn": "3023" + }, + { + "name": "Angelica Ramos", + "position": "System Architect", + "salary": "$2,875", + "start_date": { + "display": "Fri 9th Oct 09", + "timestamp": "1255039200" + }, + "office": "London", + "extn": "5797" + }, + { + "name": "Gavin Joyce", + "position": "Developer", + "salary": "$4,525", + "start_date": { + "display": "Wed 22nd Dec 10", + "timestamp": "1292972400" + }, + "office": "Edinburgh", + "extn": "8822" + }, + { + "name": "Jennifer Chang", + "position": "Regional Director", + "salary": "$4,080", + "start_date": { + "display": "Sun 14th Nov 10", + "timestamp": "1289689200" + }, + "office": "London", + "extn": "9239" + }, + { + "name": "Brenden Wagner", + "position": "Software Engineer", + "salary": "$3,750", + "start_date": { + "display": "Tue 7th Jun 11", + "timestamp": "1307397600" + }, + "office": "San Francisco", + "extn": "1314" + }, + { + "name": "Ebony Grimes", + "position": "Software Engineer", + "salary": "$2,875", + "start_date": { + "display": "Thu 11th Mar 10", + "timestamp": "1268262000" + }, + "office": "San Francisco", + "extn": "2947" + }, + { + "name": "Russell Chavez", + "position": "Director", + "salary": "$3,600", + "start_date": { + "display": "Sun 14th Aug 11", + "timestamp": "1313272800" + }, + "office": "Edinburgh", + "extn": "8899" + }, + { + "name": "Michelle House", + "position": "Integration Specialist", + "salary": "$3,750", + "start_date": { + "display": "Thu 2nd Jun 11", + "timestamp": "1306965600" + }, + "office": "Edinburgh", + "extn": "2769" + }, + { + "name": "Suki Burks", + "position": "Developer", + "salary": "$2,875", + "start_date": { + "display": "Thu 22nd Oct 09", + "timestamp": "1256162400" + }, + "office": "London", + "extn": "6832" + }, + { + "name": "Prescott Bartlett", + "position": "Technical Author", + "salary": "$6,730", + "start_date": { + "display": "Sat 7th May 11", + "timestamp": "1304719200" + }, + "office": "London", + "extn": "3606" + }, + { + "name": "Gavin Cortez", + "position": "Technical Author", + "salary": "$6,730", + "start_date": { + "display": "Sun 26th Oct 08", + "timestamp": "1224972000" + }, + "office": "San Francisco", + "extn": "2860" + }, + { + "name": "Martena Mccray", + "position": "Integration Specialist", + "salary": "$4,080", + "start_date": { + "display": "Wed 9th Mar 11", + "timestamp": "1299625200" + }, + "office": "Edinburgh", + "extn": "8240" + }, + { + "name": "Unity Butler", + "position": "Senior Marketing Designer", + "salary": "$3,750", + "start_date": { + "display": "Wed 9th Dec 09", + "timestamp": "1260313200" + }, + "office": "San Francisco", + "extn": "5384" + }, + { + "name": "Howard Hatfield", + "position": "Financial Controller", + "salary": "$4,080", + "start_date": { + "display": "Tue 16th Dec 08", + "timestamp": "1229382000" + }, + "office": "San Francisco", + "extn": "7031" + }, + { + "name": "Hope Fuentes", + "position": "Financial Controller", + "salary": "$4,200", + "start_date": { + "display": "Fri 12th Feb 10", + "timestamp": "1265929200" + }, + "office": "San Francisco", + "extn": "6318" + }, + { + "name": "Vivian Harrell", + "position": "System Architect", + "salary": "$4,965", + "start_date": { + "display": "Sat 14th Feb 09", + "timestamp": "1234566000" + }, + "office": "San Francisco", + "extn": "9422" + }, + { + "name": "Timothy Mooney", + "position": "Financial Controller", + "salary": "$4,200", + "start_date": { + "display": "Thu 11th Dec 08", + "timestamp": "1228950000" + }, + "office": "London", + "extn": "7580" + }, + { + "name": "Jackson Bradshaw", + "position": "Director", + "salary": "$5,000", + "start_date": { + "display": "Fri 26th Sep 08", + "timestamp": "1222380000" + }, + "office": "New York", + "extn": "1042" + }, + { + "name": "Miriam Weiss", + "position": "Support Engineer", + "salary": "$4,965", + "start_date": { + "display": "Thu 3rd Feb 11", + "timestamp": "1296687600" + }, + "office": "Edinburgh", + "extn": "2120" + }, + { + "name": "Bruno Nash", + "position": "Software Engineer", + "salary": "$4,200", + "start_date": { + "display": "Tue 3rd May 11", + "timestamp": "1304373600" + }, + "office": "London", + "extn": "6222" + }, + { + "name": "Odessa Jackson", + "position": "Support Engineer", + "salary": "$3,600", + "start_date": { + "display": "Wed 19th Aug 09", + "timestamp": "1250632800" + }, + "office": "Edinburgh", + "extn": "9383" + }, + { + "name": "Thor Walton", + "position": "Developer", + "salary": "$3,600", + "start_date": { + "display": "Sun 11th Aug 13", + "timestamp": "1376172000" + }, + "office": "New York", + "extn": "8327" + }, + { + "name": "Finn Camacho", + "position": "Support Engineer", + "salary": "$4,800", + "start_date": { + "display": "Tue 7th Jul 09", + "timestamp": "1246917600" + }, + "office": "San Francisco", + "extn": "2927" + }, + { + "name": "Elton Baldwin", + "position": "Data Coordinator", + "salary": "$6,730", + "start_date": { + "display": "Mon 9th Apr 12", + "timestamp": "1333922400" + }, + "office": "Edinburgh", + "extn": "8352" + }, + { + "name": "Zenaida Frank", + "position": "Software Engineer", + "salary": "$4,800", + "start_date": { + "display": "Mon 4th Jan 10", + "timestamp": "1262559600" + }, + "office": "New York", + "extn": "7439" + }, + { + "name": "Zorita Serrano", + "position": "Software Engineer", + "salary": "$5,300", + "start_date": { + "display": "Fri 1st Jun 12", + "timestamp": "1338501600" + }, + "office": "San Francisco", + "extn": "4389" + }, + { + "name": "Jennifer Acosta", + "position": "Javascript Developer", + "salary": "$2,875", + "start_date": { + "display": "Fri 1st Feb 13", + "timestamp": "1359673200" + }, + "office": "Edinburgh", + "extn": "3431" + }, + { + "name": "Cara Stevens", + "position": "Sales Assistant", + "salary": "$4,800", + "start_date": { + "display": "Tue 6th Dec 11", + "timestamp": "1323126000" + }, + "office": "New York", + "extn": "3990" + }, + { + "name": "Hermione Butler", + "position": "Director", + "salary": "$4,080", + "start_date": { + "display": "Mon 21st Mar 11", + "timestamp": "1300662000" + }, + "office": "London", + "extn": "1016" + }, + { + "name": "Lael Greer", + "position": "Systems Administrator", + "salary": "$3,120", + "start_date": { + "display": "Fri 27th Feb 09", + "timestamp": "1235689200" + }, + "office": "London", + "extn": "6733" + }, + { + "name": "Jonas Alexander", + "position": "Developer", + "salary": "$5,300", + "start_date": { + "display": "Wed 14th Jul 10", + "timestamp": "1279058400" + }, + "office": "San Francisco", + "extn": "8196" + }, + { + "name": "Shad Decker", + "position": "Regional Director", + "salary": "$5,300", + "start_date": { + "display": "Thu 13th Nov 08", + "timestamp": "1226530800" + }, + "office": "Edinburgh", + "extn": "6373" + }, + { + "name": "Michael Bruce", + "position": "Javascript Developer", + "salary": "$4,080", + "start_date": { + "display": "Mon 27th Jun 11", + "timestamp": "1309125600" + }, + "office": "Edinburgh", + "extn": "5384" + }, + { + "name": "Donna Snider", + "position": "System Architect", + "salary": "$3,120", + "start_date": { + "display": "Tue 25th Jan 11", + "timestamp": "1295910000" + }, + "office": "New York", + "extn": "4226" + } + ] +} \ No newline at end of file diff --git a/examples/ajax/orthogonal-data.html b/examples/ajax/orthogonal-data.html new file mode 100644 index 00000000..03d72fc8 --- /dev/null +++ b/examples/ajax/orthogonal-data.html @@ -0,0 +1,336 @@ + + + + + + + DataTables example - Orthogonal data + + + + + + + + + + + + +
+
+

DataTables example - Orthogonal data

+ +
+

To try and make life easy, by default, DataTables expects arrays to be used as the data source for + rows in the table. However, this isn't always useful, and you may wish to have DataTables use objects + as the data source for each row (i.e. each row has its data described by an object) as this can make + working with the data much more understandable, particularly if you are using the API and you don't + need to keep track of array indexes.

+ +

This can be done quite simply by using the columns.data option which you use to tell DataTables which property + to use from the data source object for each column.

+ +

In this example the Ajax source returns an array of objects, which DataTables uses to display the + table. The structure of the row's data source in this example is:

+
+{
+	"name":	   "Tiger Nixon",
+	"position":   "System Architect",
+	"salary":	 "$3,120",
+	"start_date": {
+		"display": "Mon 25th Apr 11",
+		"timestamp": "1303682400"
+	},
+	"office":	 "Edinburgh",
+	"extn":	   "5421"
+}
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + +
NamePositionOfficeExtn.Start dateSalary
NamePositionOfficeExtn.Start dateSalary
+ + + +
+
+

The Javascript shown below is used to initialise the table shown in this + example:

$(document).ready(function() { + $('#example').dataTable( { + ajax: "data/orthogonal.txt", + columns: [ + { data: "name" }, + { data: "position" }, + { data: "office" }, + { data: "extn" }, + { data: { + _: "start_date.display", + sort: "start_date.timestamp" + } }, + { data: "salary" } + ] + } ); +} ); + +

In addition to the above code, the following Javascript library files are loaded for use in this + example:

+ + +
+ +
+

The HTML shown below is the raw HTML table element, before it has been enhanced by + DataTables:

+
+ +
+
+

This example uses a little bit of additional CSS beyond what is loaded from the library + files (below), in order to correctly display the table. The additional CSS used is shown + below:

+
+ +

The following CSS library files are loaded for use in this example to provide the styling of the + table:

+ + +
+ +
+

This table loads data by Ajax. The latest data that has been loaded is shown below. This data + will update automatically as any additional data is loaded.

+
+ +
+

The script used to perform the server-side processing for this table is shown below. Please note + that this is just an example script using PHP. Server-side processing scripts can be written in any + language, using the protocol described in the + DataTables documentation.

+
+
+
+
+ +
+ +
+ + \ No newline at end of file diff --git a/examples/index.html b/examples/index.html new file mode 100644 index 00000000..eb3d18f7 --- /dev/null +++ b/examples/index.html @@ -0,0 +1,188 @@ + + + + + + + + + + + + DataTables examples - Examples index + + + +
+
+

DataTables example - Examples index

+ +
+

One of the best ways of learning how to do anything new (including software APIs!) is to get your + hands dirty as quickly as possible. These examples will show you how to perform tasks ranging from + something as simple as applying DataTables to an HTML table, right the way through to doing server-side + processing with pipelining and custom plug-in functions.

+
+
+
+ +
+ +
+ + \ No newline at end of file diff --git a/examples/resources/examples.php b/examples/resources/examples.php new file mode 100644 index 00000000..303d3bdb --- /dev/null +++ b/examples/resources/examples.php @@ -0,0 +1,10 @@ + .sorting_1, +table.dataTable.order-column tbody tr > .sorting_2, +table.dataTable.order-column tbody tr > .sorting_3, table.dataTable.display tbody tr > .sorting_1, +table.dataTable.display tbody tr > .sorting_2, +table.dataTable.display tbody tr > .sorting_3 { + background-color: #f9f9f9; +} +table.dataTable.order-column tbody tr.selected > .sorting_1, +table.dataTable.order-column tbody tr.selected > .sorting_2, +table.dataTable.order-column tbody tr.selected > .sorting_3, table.dataTable.display tbody tr.selected > .sorting_1, +table.dataTable.display tbody tr.selected > .sorting_2, +table.dataTable.display tbody tr.selected > .sorting_3 { + background-color: #acbad4; +} +table.dataTable.display tbody tr.odd > .sorting_1, table.dataTable.order-column.stripe tbody tr.odd > .sorting_1 { + background-color: #f1f1f1; +} +table.dataTable.display tbody tr.odd > .sorting_2, table.dataTable.order-column.stripe tbody tr.odd > .sorting_2 { + background-color: #f3f3f3; +} +table.dataTable.display tbody tr.odd > .sorting_3, table.dataTable.order-column.stripe tbody tr.odd > .sorting_3 { + background-color: whitesmoke; +} +table.dataTable.display tbody tr.odd.selected > .sorting_1, table.dataTable.order-column.stripe tbody tr.odd.selected > .sorting_1 { + background-color: #a6b3cd; +} +table.dataTable.display tbody tr.odd.selected > .sorting_2, table.dataTable.order-column.stripe tbody tr.odd.selected > .sorting_2 { + background-color: #a7b5ce; +} +table.dataTable.display tbody tr.odd.selected > .sorting_3, table.dataTable.order-column.stripe tbody tr.odd.selected > .sorting_3 { + background-color: #a9b6d0; +} +table.dataTable.display tbody tr.even > .sorting_1, table.dataTable.order-column.stripe tbody tr.even > .sorting_1 { + background-color: #f9f9f9; +} +table.dataTable.display tbody tr.even > .sorting_2, table.dataTable.order-column.stripe tbody tr.even > .sorting_2 { + background-color: #fbfbfb; +} +table.dataTable.display tbody tr.even > .sorting_3, table.dataTable.order-column.stripe tbody tr.even > .sorting_3 { + background-color: #fdfdfd; +} +table.dataTable.display tbody tr.even.selected > .sorting_1, table.dataTable.order-column.stripe tbody tr.even.selected > .sorting_1 { + background-color: #acbad4; +} +table.dataTable.display tbody tr.even.selected > .sorting_2, table.dataTable.order-column.stripe tbody tr.even.selected > .sorting_2 { + background-color: #adbbd6; +} +table.dataTable.display tbody tr.even.selected > .sorting_3, table.dataTable.order-column.stripe tbody tr.even.selected > .sorting_3 { + background-color: #afbdd8; +} +table.dataTable.display tbody tr:hover > .sorting_1, +table.dataTable.display tbody tr.odd:hover > .sorting_1, +table.dataTable.display tbody tr.even:hover > .sorting_1, table.dataTable.order-column.hover tbody tr:hover > .sorting_1, +table.dataTable.order-column.hover tbody tr.odd:hover > .sorting_1, +table.dataTable.order-column.hover tbody tr.even:hover > .sorting_1 { + background-color: #eaeaea; +} +table.dataTable.display tbody tr:hover > .sorting_2, +table.dataTable.display tbody tr.odd:hover > .sorting_2, +table.dataTable.display tbody tr.even:hover > .sorting_2, table.dataTable.order-column.hover tbody tr:hover > .sorting_2, +table.dataTable.order-column.hover tbody tr.odd:hover > .sorting_2, +table.dataTable.order-column.hover tbody tr.even:hover > .sorting_2 { + background-color: #ebebeb; +} +table.dataTable.display tbody tr:hover > .sorting_3, +table.dataTable.display tbody tr.odd:hover > .sorting_3, +table.dataTable.display tbody tr.even:hover > .sorting_3, table.dataTable.order-column.hover tbody tr:hover > .sorting_3, +table.dataTable.order-column.hover tbody tr.odd:hover > .sorting_3, +table.dataTable.order-column.hover tbody tr.even:hover > .sorting_3 { + background-color: #eeeeee; +} +table.dataTable.display tbody tr:hover.selected > .sorting_1, +table.dataTable.display tbody tr.odd:hover.selected > .sorting_1, +table.dataTable.display tbody tr.even:hover.selected > .sorting_1, table.dataTable.order-column.hover tbody tr:hover.selected > .sorting_1, +table.dataTable.order-column.hover tbody tr.odd:hover.selected > .sorting_1, +table.dataTable.order-column.hover tbody tr.even:hover.selected > .sorting_1 { + background-color: #a1aec7; +} +table.dataTable.display tbody tr:hover.selected > .sorting_2, +table.dataTable.display tbody tr.odd:hover.selected > .sorting_2, +table.dataTable.display tbody tr.even:hover.selected > .sorting_2, table.dataTable.order-column.hover tbody tr:hover.selected > .sorting_2, +table.dataTable.order-column.hover tbody tr.odd:hover.selected > .sorting_2, +table.dataTable.order-column.hover tbody tr.even:hover.selected > .sorting_2 { + background-color: #a2afc8; +} +table.dataTable.display tbody tr:hover.selected > .sorting_3, +table.dataTable.display tbody tr.odd:hover.selected > .sorting_3, +table.dataTable.display tbody tr.even:hover.selected > .sorting_3, table.dataTable.order-column.hover tbody tr:hover.selected > .sorting_3, +table.dataTable.order-column.hover tbody tr.odd:hover.selected > .sorting_3, +table.dataTable.order-column.hover tbody tr.even:hover.selected > .sorting_3 { + background-color: #a4b2cb; +} + +table.dataTable, +table.dataTable th, +table.dataTable td { + -webkit-box-sizing: content-box; + -moz-box-sizing: content-box; + box-sizing: content-box; +} + +/* + * Control feature layout + */ +.dataTables_wrapper { + position: relative; + clear: both; + *zoom: 1; + zoom: 1; +} +.dataTables_wrapper .dataTables_length { + float: left; +} +.dataTables_wrapper .dataTables_filter { + float: right; + text-align: right; +} +.dataTables_wrapper .dataTables_filter input { + margin-left: 0.5em; +} +.dataTables_wrapper .dataTables_info { + clear: both; + float: left; + padding-top: 0.55em; +} +.dataTables_wrapper .dataTables_paginate { + float: right; + text-align: right; +} +.dataTables_wrapper .dataTables_paginate .fg-button { + box-sizing: border-box; + display: inline-block; + min-width: 1.5em; + padding: 0.5em; + margin-left: 2px; + text-align: center; + text-decoration: none !important; + cursor: pointer; + *cursor: hand; + color: #333333 !important; + border: 1px solid transparent; +} +.dataTables_wrapper .dataTables_paginate .fg-button:active { + outline: none; +} +.dataTables_wrapper .dataTables_paginate .fg-button:first-child { + border-top-left-radius: 3px; + border-bottom-left-radius: 3px; +} +.dataTables_wrapper .dataTables_paginate .fg-button:last-child { + border-top-right-radius: 3px; + border-bottom-right-radius: 3px; +} +.dataTables_wrapper .dataTables_processing { + position: absolute; + top: 50%; + left: 50%; + width: 100%; + height: 40px; + margin-left: -50%; + margin-top: -25px; + padding-top: 20px; + text-align: center; + font-size: 1.2em; + background-color: white; + background: -webkit-gradient(linear, left top, right top, color-stop(0%, rgba(255, 255, 255, 0)), color-stop(25%, rgba(255, 255, 255, 0.9)), color-stop(75%, rgba(255, 255, 255, 0.9)), color-stop(100%, rgba(255, 255, 255, 0))); + /* Chrome,Safari4+ */ + background: -webkit-linear-gradient(left, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.9) 25%, rgba(255, 255, 255, 0.9) 75%, rgba(255, 255, 255, 0) 100%); + /* Chrome10+,Safari5.1+ */ + background: -moz-linear-gradient(left, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.9) 25%, rgba(255, 255, 255, 0.9) 75%, rgba(255, 255, 255, 0) 100%); + /* FF3.6+ */ + background: -ms-linear-gradient(left, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.9) 25%, rgba(255, 255, 255, 0.9) 75%, rgba(255, 255, 255, 0) 100%); + /* IE10+ */ + background: -o-linear-gradient(left, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.9) 25%, rgba(255, 255, 255, 0.9) 75%, rgba(255, 255, 255, 0) 100%); + /* Opera 11.10+ */ + background: linear-gradient(to right, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.9) 25%, rgba(255, 255, 255, 0.9) 75%, rgba(255, 255, 255, 0) 100%); + /* W3C */ +} +.dataTables_wrapper .dataTables_length, +.dataTables_wrapper .dataTables_filter, +.dataTables_wrapper .dataTables_info, +.dataTables_wrapper .dataTables_processing, +.dataTables_wrapper .dataTables_paginate { + color: #333333; +} +.dataTables_wrapper .dataTables_scroll { + clear: both; +} +.dataTables_wrapper .dataTables_scrollBody { + *margin-top: -1px; + -webkit-overflow-scrolling: touch; +} +.dataTables_wrapper .ui-widget-header { + font-weight: normal; +} +.dataTables_wrapper .ui-toolbar { + padding: 8px; +} +.dataTables_wrapper:after { + visibility: hidden; + display: block; + content: ""; + clear: both; + height: 0; +} diff --git a/examples/resources/jqueryui/dataTables.jqueryui.js b/examples/resources/jqueryui/dataTables.jqueryui.js new file mode 100644 index 00000000..3575e822 --- /dev/null +++ b/examples/resources/jqueryui/dataTables.jqueryui.js @@ -0,0 +1,102 @@ + +(function(){ + +var DataTable = $.fn.dataTable; +var sort_prefix = 'css_right ui-icon ui-icon-'; +var toolbar_prefix = 'fg-toolbar ui-toolbar ui-widget-header ui-helper-clearfix ui-corner-'; + +/* Set the defaults for DataTables initialisation */ +$.extend( true, DataTable.defaults, { + dom: + '<"'+toolbar_prefix+'tl ui-corner-tr"lfr>'+ + 't'+ + '<"'+toolbar_prefix+'bl ui-corner-br"ip>', + renderer: 'jqueryui' +} ); + + +$.extend( DataTable.ext.classes, { + /* Full numbers paging buttons */ + "sPageButton": "fg-button ui-button ui-state-default", + "sPageButtonActive": "ui-state-disabled", + "sPageButtonDisabled": "ui-state-disabled", + + /* Features */ + "sPaging": "dataTables_paginate fg-buttonset ui-buttonset fg-buttonset-multi "+ + "ui-buttonset-multi paging_", /* Note that the type is postfixed */ + + /* Sorting */ + "sSortAsc": "ui-state-default sorting_asc", + "sSortDesc": "ui-state-default sorting_desc", + "sSortable": "ui-state-default sorting", + "sSortableAsc": "ui-state-default sorting_asc_disabled", + "sSortableDesc": "ui-state-default sorting_desc_disabled", + "sSortableNone": "ui-state-default sorting_disabled", + "sSortIcon": "DataTables_sort_icon", + + /* Scrolling */ + "sScrollHead": "dataTables_scrollHead "+"ui-state-default", + "sScrollFoot": "dataTables_scrollFoot "+"ui-state-default", + + /* Misc */ + "sHeaderTH": "ui-state-default", + "sFooterTH": "ui-state-default", +} ); + + +DataTable.ext.renderer.header.jqueryui = function ( settings, cell, column, idx, classes ) { + $('
') + .addClass( 'DataTables_sort_wrapper' ) + .append( cell.contents() ) + .append( $('') + .addClass( classes.sSortIcon+' '+column.sSortingClassJUI ) + ) + .appendTo( cell ); + + // Attach a sort listener to update on sort + $(settings.nTable).on( 'order.dt', function ( e, settings, sorting, columns ) { + cell + .removeClass( classes.sSortAsc +" "+classes.sSortDesc ) + .addClass( columns[ idx ] == 'asc' ? + classes.sSortAsc : columns[ idx ] == 'desc' ? + classes.sSortDesc : + column.sSortingClass + ); + + cell + .find( 'span' ) + .removeClass( + sort_prefix+'triangle-1-n' +" "+ + sort_prefix+'triangle-1-s' +" "+ + sort_prefix+'carat-2-n-s' +" "+ + sort_prefix+'carat-1-n' +" "+ + sort_prefix+'carat-1-s' + ) + .addClass( columns[ idx ] == 'asc' ? + sort_prefix+'triangle-1-n' : columns[ idx ] == 'desc' ? + sort_prefix+'triangle-1-s' : + column.sSortingClassJUI + ); + } ); +} + + +/* + * TableTools jQuery UI compatibility + * Required TableTools 2.1+ + */ +if ( DataTable.TableTools ) { + $.extend( true, DataTable.TableTools.classes, { + "container": "DTTT_container ui-buttonset ui-buttonset-multi", + "buttons": { + "normal": "DTTT_button ui-button ui-state-default" + }, + "collection": { + "container": "DTTT_collection ui-buttonset ui-buttonset-multi" + } + } ); +} + + +}()); + diff --git a/examples/resources/jqueryui/dataTables.jqueryui.scss b/examples/resources/jqueryui/dataTables.jqueryui.scss new file mode 100644 index 00000000..910dc6a8 --- /dev/null +++ b/examples/resources/jqueryui/dataTables.jqueryui.scss @@ -0,0 +1,408 @@ + + + // + // Colour customisation + // + +// Border between the header (and footer) and the table body +$table-header-border: 1px solid #111; + +// Border of rows / cells +$table-body-border: 1px solid #ddd; + +// Row background colour (hover, striping etc are all based on this colour and +// calculated automatically) +$table-row-background: #ffffff; + +// Row colour, when selected (tr.selected) +$table-row-selected: #B0BED9; + +// Text colour of the interaction control elements (info, filter, paging etc) +$table-control-color: #333; + +// Highlight colour of the paging button for the current page +$table-paging-button-active: #dcdcdc; + +// Hover colour of paging buttons on mouse over +$table-paging-button-hover: #111; + + + +// +// Functions / mixins +// +@function tint( $color, $percent ) { + @return mix(white, $color, $percent); +} + +@function shade( $color, $percent ) { + @return mix(black, $color, $percent); +} + +@mixin gradient( $from, $to ) { + background-color: $from; + background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,$from), color-stop(100%,$to)); /* Chrome,Safari4+ */ + background: -webkit-linear-gradient(top, $from 0%, $to 100%); /* Chrome10+,Safari5.1+ */ + background: -moz-linear-gradient(top, $from 0%, $to 100%); /* FF3.6+ */ + background: -ms-linear-gradient(top, $from 0%, $to 100%); /* IE10+ */ + background: -o-linear-gradient(top, $from 0%, $to 100%); /* Opera 11.10+ */ + background: linear-gradient(to bottom, $from 0%, $to 100%); /* W3C */ +} + + +/* + * Table styles + */ +table.dataTable { + width: 100%; + margin: 0 auto; + clear: both; + border-collapse: separate; + border-spacing: 0; + + /* + * Header and footer styles + */ + thead, + tfoot { + th, + td { + padding: 4px 10px; + } + + th { + font-weight: bold; + } + } + + thead th, + thead td { + &:active { + outline: none; + } + } + + // Sorting + thead { + .sorting_asc, + .sorting_desc, + .sorting { + cursor: pointer; + *cursor: hand; + } + + th div.DataTables_sort_wrapper { + position: relative; + padding-right: 10px; + + span { + position: absolute; + top: 50%; + margin-top: -8px; + right: -5px; + } + } + + th.ui-state-default { + border-right-width: 0; + + &:last-child { + border-right-width: 1px; + } + } + } + + + /* + * Body styles + */ + tbody { + tr { + background-color: $table-row-background; + + &.selected { + background-color: $table-row-selected; + } + } + + th, + td { + padding: 8px 10px; + } + } + + th.center, + td.center, + td.dataTables_empty { + text-align: center; + } + + th.right, + td.right { + text-align: right; + } + + + // Stripe classes - add "row-border" class to the table to activate + &.row-border tbody, + &.display tbody { + th, td { + border-top: $table-body-border; + } + + tr:first-child th, + tr:first-child td { + border-top: none; + } + } + + + // Stripe classes - add "cell-border" class to the table to activate + &.cell-border tbody { + th, td { + border-top: $table-body-border; + border-right: $table-body-border; + } + + tr th:first-child, + tr td:first-child { + border-left: $table-body-border; + } + + tr:first-child th, + tr:first-child td { + border-top: none; + } + } + + + // Stripe classes - add "stripe" class to the table to activate + &.stripe tbody, + &.display tbody { + tr.odd { + background-color: shade($table-row-background, 2.35%); // shade by f9 + + &.selected { + background-color: shade($table-row-selected, 2.35%); + } + } + } + + + // Hover classes - add "hover" class to the table to activate + &.hover tbody, + &.display tbody { + tr:hover, + tr.odd:hover, + tr.even:hover { + background-color: shade($table-row-background, 3.6%); // shade by f5 + + &.selected { + background-color: shade($table-row-selected, 3.6%); + } + } + } + + + // Sort column highlighting - add "hover" class to the table to activate + &.order-column, + &.display { + tbody { + tr>.sorting_1, + tr>.sorting_2, + tr>.sorting_3 { + background-color: shade($table-row-background, 2%); // shade by fa + } + + tr.selected>.sorting_1, + tr.selected>.sorting_2, + tr.selected>.sorting_3 { + background-color: shade($table-row-selected, 2%); + } + } + } + + &.display tbody, + &.order-column.stripe tbody { + tr.odd { + >.sorting_1 { background-color: shade($table-row-background, 5.4%); } // shade by f1 + >.sorting_2 { background-color: shade($table-row-background, 4.7%); } // shade by f3 + >.sorting_3 { background-color: shade($table-row-background, 3.9%); } // shade by f5 + + &.selected { + >.sorting_1 { background-color: shade($table-row-selected, 5.4%); } + >.sorting_2 { background-color: shade($table-row-selected, 4.7%); } + >.sorting_3 { background-color: shade($table-row-selected, 3.9%); } + } + } + + tr.even { + >.sorting_1 { background-color: shade($table-row-background, 2%); } // shade by fa + >.sorting_2 { background-color: shade($table-row-background, 1.2%); } // shade by fc + >.sorting_3 { background-color: shade($table-row-background, 0.4%); } // shade by fe + + &.selected { + >.sorting_1 { background-color: shade($table-row-selected, 2%); } + >.sorting_2 { background-color: shade($table-row-selected, 1.2%); } + >.sorting_3 { background-color: shade($table-row-selected, 0.4%); } + } + } + } + + &.display tbody, + &.order-column.hover tbody { + tr:hover, + tr.odd:hover, + tr.even:hover { + >.sorting_1 { background-color: shade($table-row-background, 8.2%); } // shade by ea + >.sorting_2 { background-color: shade($table-row-background, 7.5%); } // shade by ec + >.sorting_3 { background-color: shade($table-row-background, 6.3%); } // shade by ef + + &.selected { + >.sorting_1 { background-color: shade($table-row-selected, 8.2%); } + >.sorting_2 { background-color: shade($table-row-selected, 7.5%); } + >.sorting_3 { background-color: shade($table-row-selected, 6.3%); } + } + } + } +} + +// Its not uncommon to use * {border-box} now, but it messes up the column width +// calculations, so use content-box for the table and cells +table.dataTable, +table.dataTable th, +table.dataTable td { + -webkit-box-sizing: content-box; + -moz-box-sizing: content-box; + box-sizing: content-box; +} + + + +/* + * Control feature layout + */ +.dataTables_wrapper { + position: relative; + clear: both; + *zoom: 1; + + // Page length options + .dataTables_length { + float: left; + } + + // Filtering input + .dataTables_filter { + float: right; + text-align: right; + + input { + margin-left: 0.5em; + } + } + + // Table info + .dataTables_info { + clear: both; + float: left; + padding-top: 0.55em; + } + + // Paging + .dataTables_paginate { + float: right; + text-align: right; + + .fg-button { + box-sizing: border-box; + display: inline-block; + min-width: 1.5em; + padding: 0.5em; + margin-left: 2px; + text-align: center; + text-decoration: none !important; + cursor: pointer; + *cursor: hand; + + color: $table-control-color !important; + border: 1px solid transparent; + + &:active { + outline: none; + } + } + + .fg-button:first-child { + border-top-left-radius: 3px; + border-bottom-left-radius: 3px; + } + + .fg-button:last-child { + border-top-right-radius: 3px; + border-bottom-right-radius: 3px; + } + } + + // Processing + .dataTables_processing { + position: absolute; + top: 50%; + left: 50%; + width: 100%; + height: 40px; + margin-left: -50%; + margin-top: -25px; + padding-top: 20px; + + text-align: center; + font-size: 1.2em; + + background-color: white; + background: -webkit-gradient(linear, left top, right top, color-stop(0%,rgba($table-row-background, 0)), color-stop(25%,rgba($table-row-background, 0.9)), color-stop(75%,rgba($table-row-background, 0.9)), color-stop(100%,rgba(255,255,255,0))); /* Chrome,Safari4+ */ + background: -webkit-linear-gradient(left, rgba($table-row-background, 0) 0%, rgba($table-row-background, 0.9) 25%, rgba($table-row-background, 0.9) 75%, rgba($table-row-background, 0) 100%); /* Chrome10+,Safari5.1+ */ + background: -moz-linear-gradient(left, rgba($table-row-background, 0) 0%, rgba($table-row-background, 0.9) 25%, rgba($table-row-background, 0.9) 75%, rgba($table-row-background, 0) 100%); /* FF3.6+ */ + background: -ms-linear-gradient(left, rgba($table-row-background, 0) 0%, rgba($table-row-background, 0.9) 25%, rgba($table-row-background, 0.9) 75%, rgba($table-row-background, 0) 100%); /* IE10+ */ + background: -o-linear-gradient(left, rgba($table-row-background, 0) 0%, rgba($table-row-background, 0.9) 25%, rgba($table-row-background, 0.9) 75%, rgba($table-row-background, 0) 100%); /* Opera 11.10+ */ + background: linear-gradient(to right, rgba($table-row-background, 0) 0%, rgba($table-row-background, 0.9) 25%, rgba($table-row-background, 0.9) 75%, rgba($table-row-background, 0) 100%); /* W3C */ + } + + .dataTables_length, + .dataTables_filter, + .dataTables_info, + .dataTables_processing, + .dataTables_paginate { + color: $table-control-color; + } + + // Scrolling + .dataTables_scroll { + clear: both; + } + + .dataTables_scrollBody { + *margin-top: -1px; + -webkit-overflow-scrolling: touch; + } + + + .ui-widget-header { + font-weight: normal; + } + + .ui-toolbar { + padding: 8px; + } + + // Self clear the wrapper + &:after { + visibility: hidden; + display: block; + content: ""; + clear: both; + height: 0; + } + zoom: 1; // Poor old IE +} + + diff --git a/examples/resources/jqueryui/index.html b/examples/resources/jqueryui/index.html new file mode 100644 index 00000000..303dbc15 --- /dev/null +++ b/examples/resources/jqueryui/index.html @@ -0,0 +1,443 @@ + + + + + + DataTables jQuery UI example + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Rendering engineBrowserPlatform(s)Engine versionCSS grade
TridentInternet + Explorer 4.0Win 95+ 4X
TridentInternet + Explorer 5.0Win 95+5C
TridentInternet + Explorer 5.5Win 95+5.5A
TridentInternet + Explorer 6Win 98+6A
TridentInternet Explorer 7Win XP SP2+7A
TridentAOL browser (AOL desktop)Win XP6A
GeckoFirefox 1.0Win 98+ / OSX.2+1.7A
GeckoFirefox 1.5Win 98+ / OSX.2+1.8A
GeckoFirefox 2.0Win 98+ / OSX.2+1.8A
GeckoFirefox 3.0Win 2k+ / OSX.3+1.9A
GeckoCamino 1.0OSX.2+1.8A
GeckoCamino 1.5OSX.3+1.8A
GeckoNetscape 7.2Win 95+ / Mac OS 8.6-9.21.7A
GeckoNetscape Browser 8Win 98SE+1.7A
GeckoNetscape Navigator 9Win 98+ / OSX.2+1.8A
GeckoMozilla 1.0Win 95+ / OSX.1+1A
GeckoMozilla 1.1Win 95+ / OSX.1+1.1A
GeckoMozilla 1.2Win 95+ / OSX.1+1.2A
GeckoMozilla 1.3Win 95+ / OSX.1+1.3A
GeckoMozilla 1.4Win 95+ / OSX.1+1.4A
GeckoMozilla 1.5Win 95+ / OSX.1+1.5A
GeckoMozilla 1.6Win 95+ / OSX.1+1.6A
GeckoMozilla 1.7Win 98+ / OSX.1+1.7A
GeckoMozilla 1.8Win 98+ / OSX.1+1.8A
GeckoSeamonkey 1.1Win 98+ / OSX.2+1.8A
GeckoEpiphany 2.20Gnome1.8A
WebkitSafari 1.2OSX.3125.5A
WebkitSafari 1.3OSX.3312.8A
WebkitSafari 2.0OSX.4+419.3A
WebkitSafari 3.0OSX.4+522.1A
WebkitOmniWeb 5.5OSX.4+420A
WebkitiPod Touch / iPhoneiPod420.1A
WebkitS60S60413A
PrestoOpera 7.0Win 95+ / OSX.1+-A
PrestoOpera 7.5Win 95+ / OSX.2+-A
PrestoOpera 8.0Win 95+ / OSX.2+-A
PrestoOpera 8.5Win 95+ / OSX.2+-A
PrestoOpera 9.0Win 95+ / OSX.3+-A
PrestoOpera 9.2Win 88+ / OSX.3+-A
PrestoOpera 9.5Win 88+ / OSX.3+-A
PrestoOpera for WiiWii-A
PrestoNokia N800N800-A
PrestoNintendo DS browserNintendo DS8.5C/A1
KHTMLKonqureror 3.1KDE 3.13.1C
KHTMLKonqureror 3.3KDE 3.33.3A
KHTMLKonqureror 3.5KDE 3.53.5A
TasmanInternet Explorer 4.5Mac OS 8-9-X
TasmanInternet Explorer 5.1Mac OS 7.6-91C
TasmanInternet Explorer 5.2Mac OS 8-X1C
MiscNetFront 3.1Embedded devices-C
MiscNetFront 3.4Embedded devices-A
MiscDillo 0.8Embedded devices-X
MiscLinksText only-X
MiscLynxText only-X
MiscIE MobileWindows Mobile 6-C
MiscPSP browserPSP-C
Other browsersAll others--U
+ +
+ + \ No newline at end of file