DataTablesSrc-1.10.11/000077500000000000000000000000001265711500300143275ustar00rootroot00000000000000DataTablesSrc-1.10.11/.gitignore000066400000000000000000000000531265711500300163150ustar00rootroot00000000000000built .DS_Store css/.sass-cache extensions DataTablesSrc-1.10.11/Authors.txt000066400000000000000000000012121265711500300165110ustar00rootroot00000000000000Contributors to DataTables - ordered by date of first contribution: SpryMedia Limited <@DataTables> <@kcivey> <@ghostd> <@mbp> <@michalporeba> <@Petah> <@thegrandpoobah> <@jerrykan> <@nnguyen> <@iBiryukov> <@kycook> <@timtucker> <@rikkert> <@cirosantilli> <@Tiax> <@DukeAstar> <@benn0r> <@zeitiger> <@theUniC> <@nifr> <@jdufresne> <@TonyaSolaris> <@malinow> <@masteradhoc> <@lloy0076> <@maxgalbu> <@sbine> <@msakhawat> <@netaisllc> <@zackkatz> <@bjmiller> <@dylancwood> <@abrom> <@cookieguru> <@nathanstitt> <@cdaringe> <@simonbrent> <@ieaglle> <@jfktrey> <@gauravmak> <@strang91> <@gaillafr> <@adilapapaya> <@frank-carnovale> Google Inc. <@jthsiao>DataTablesSrc-1.10.11/Contributing.md000066400000000000000000000047041265711500300173250ustar00rootroot00000000000000# Support requests Please direct support requests to the [DataTables forums](https://datatables.net/forums), ensuring that you provide a link to a test page that shows the problem and a full description of the issue. If you require urgent help, [priority support](https://datatables.net/support) is available. # Contributing code If you are thinking of contributing code to DataTables, first of all, thank you! All fixes, patches and enhancements to DataTables are very warmly welcomed. In order to keep thing manageable, there are a number of guidelines that should be followed in order to ensure that your modification is included in DataTables as quickly as possible: 1. Make contributions in the [DataTables/DataTablesSrc](https://github.com/DataTables/DataTablesSrc) repo. Changes to the built files in the built repo ([DataTables/DataTables](https://github.com/DataTables/DataTables)) will not be accepted since they would be overwritten by the next build! 2. Follow the style of the code in the existing files. They might not be to everyone's tastes, but consistency is key for a mature project like DataTables. DataTables doesn't have a coding standards document, but simple common sense of following the same style as in the existing files is ideal. For example use tabs not spaces (as you will see all source files use tabs). 3. Link to a test page showing the bug you are fixing or the feature you are adding. This allows to me to quickly identify what is being changed and why. Don't worry about being verbose in pull requests - its much better to know exactly what is changing and why! 4. DataTables is a large and complex project and it isn't always possible or suitable to pull in every suggested change. Please don't be offended if a pull request is not merged in, it will explained why not if this is the case. Also it isn't always possible to fully check and test pull requests as quickly as I would like due to other commitments. Again this is no reflection on your pull request, just the busy life that we all lead! If you have any questions about your potential contribution and its place in the DataTables project structure, please ask ahead of time in the [DataTables forums](//datatables.net/forums). 5. Pull requests will only be accepted if you acknowledge that your contribution is offered under and will be made available under the project's existing license (MIT). If your initial pull request doesn't explicitly acknowledge this I'll ask before it is pulled in.DataTablesSrc-1.10.11/Readme.md000066400000000000000000000077751265711500300160660ustar00rootroot00000000000000# DataTables plug-in for jQuery - source repository This git repository contains the un-built source files for DataTables - the table enhancing plug-in for jQuery. If you are looking to use DataTables, rather than to modify it, please use the built files in the build repo: [//github.com/DataTables/DataTables](//github.com/DataTables/DataTables). There are instructions there on how to use DataTables, and on the [DataTables site](//datatables.net) which contains the full documentation for DataTables. ## Installing DataTables To use DataTables, the primary way to obtain the software is to use the [DataTables downloader](//datatables.net/download). You can also include the individual files from the [DataTables CDN](//cdn.datatables.net). See the [documentation](//datatables.net/manual/installation) for full details. ### NPM and Bower If you prefer to use a package manager such as NPM or Bower, distribution repositories are available with software built from this repository under the name `datatables.net`. Styling packages for Bootstrap, Foundation and other styling libraries are also available by adding a suffix to the package name. Please see the DataTables [NPM](//datatables.net/download/npm) and [Bower](//datatables.net/download/bower) installation pages for further information. The [DataTables installation manual](//datatables.net/manual/installation) also has details on how to use package managers with DataTables. ## Why two repos The source repo for DataTables is kept distinct from the built repo in order to provide separation between generated files and source files. The majority of the files in the DataTables built repo are generated by compiling source files from this repo, including: * Main Javascript file - compiled from multiple individual Javascript files * CSS files -compiled from SASS files * Examples - compiled from a common data source data and HTML template files This separation allows developers who simply want to use DataTables as is, to do so, while keeping the source repo clean of generated files. ## Building DataTables can be built using the [`make.sh`](build/make.sh) script in the [`/build`](build) directory of this repo. Simply check out the repo, cd into the `build` folder and run `bash make.sh --help` to get a full list of the options available for the build process. `bash make.sh build` will be the most common (with `bash make.sh build debug` available for quick testing - it skips the minification steps for speed). A number of programs are required out your computer to be able to build DataTables: * Bash * PHP 5.4+ * [Sass](http://sass-lang.com/install) - CSS compiler * [Closure compiler](https://github.com/google/closure-compiler) - Javascript compressor * [JSHint 2.1+](http://jshint.com/install/) - Linter (optional) The build script assumes that a Mac or Linux environment is being used - Windows builds are not currently directly supported (although would be possible using [Cygwin](https://www.cygwin.com/)). Additionally, you may need to alter the paths for the above programs to reflect where they are installed on your own computer - this can be done in the [`build/include.sh`](build/include.sh) script. The output files are placed into `built/DataTables/` which is a temporary directory. No changes should be made in that directory as they will be **overwritten** when you next build the software. ## Documentation Full documentation of the DataTables options, API and plug-in interface are available on the [DataTables web-site](//datatables.net). The site also contains information on the wide variety of plug-ins that are available for DataTables, which can be used to enhance and customise your table even further. ## Support Support for DataTables is available through the [DataTables forums](//datatables.net/forums) and [commercial support options](//datatables.net/support) are available. ## License DataTables is release under the [MIT license](//datatables.net/license). You are free to use, modify and distribute this software, but all copyright information must remain. DataTablesSrc-1.10.11/build/000077500000000000000000000000001265711500300154265ustar00rootroot00000000000000DataTablesSrc-1.10.11/build/data.json000066400000000000000000000454441265711500300172450ustar00rootroot00000000000000[ { "id": "1", "sequence": 2, "first_name": "Tiger", "last_name": "Nixon", "age": "61", "position": "System Architect", "salary": "320800", "start_date": "2011/04/25", "extn": "5421", "email": "t.nixon@datatables.net", "office": "Edinburgh" }, { "id": "2", "sequence": 22, "first_name": "Garrett", "last_name": "Winters", "age": "63", "position": "Accountant", "salary": "170750", "start_date": "2011/07/25", "extn": "8422", "email": "g.winters@datatables.net", "office": "Tokyo" }, { "id": "3", "sequence": 6, "first_name": "Ashton", "last_name": "Cox", "age": "66", "position": "Junior Technical Author", "salary": "86000", "start_date": "2009/01/12", "extn": "1562", "email": "a.cox@datatables.net", "office": "San Francisco" }, { "id": "4", "sequence": 41, "first_name": "Cedric", "last_name": "Kelly", "age": "22", "position": "Senior Javascript Developer", "salary": "433060", "start_date": "2012/03/29", "extn": "6224", "email": "c.kelly@datatables.net", "office": "Edinburgh" }, { "id": "5", "sequence": 55, "first_name": "Airi", "last_name": "Satou", "age": "33", "position": "Accountant", "salary": "162700", "start_date": "2008/11/28", "extn": "5407", "email": "a.satou@datatables.net", "office": "Tokyo" }, { "id": "6", "sequence": 21, "first_name": "Brielle", "last_name": "Williamson", "age": "61", "position": "Integration Specialist", "salary": "372000", "start_date": "2012/12/02", "extn": "4804", "email": "b.williamson@datatables.net", "office": "New York" }, { "id": "7", "sequence": 46, "first_name": "Herrod", "last_name": "Chandler", "age": "59", "position": "Sales Assistant", "salary": "137500", "start_date": "2012/08/06", "extn": "9608", "email": "h.chandler@datatables.net", "office": "San Francisco" }, { "id": "8", "sequence": 50, "first_name": "Rhona", "last_name": "Davidson", "age": "55", "position": "Integration Specialist", "salary": "327900", "start_date": "2010/10/14", "extn": "6200", "email": "r.davidson@datatables.net", "office": "Tokyo" }, { "id": "9", "sequence": 26, "first_name": "Colleen", "last_name": "Hurst", "age": "39", "position": "Javascript Developer", "salary": "205500", "start_date": "2009/09/15", "extn": "2360", "email": "c.hurst@datatables.net", "office": "San Francisco" }, { "id": "10", "sequence": 18, "first_name": "Sonya", "last_name": "Frost", "age": "23", "position": "Software Engineer", "salary": "103600", "start_date": "2008/12/13", "extn": "1667", "email": "s.frost@datatables.net", "office": "Edinburgh" }, { "id": "11", "sequence": 13, "first_name": "Jena", "last_name": "Gaines", "age": "30", "position": "Office Manager", "salary": "90560", "start_date": "2008/12/19", "extn": "3814", "email": "j.gaines@datatables.net", "office": "London" }, { "id": "12", "sequence": 23, "first_name": "Quinn", "last_name": "Flynn", "age": "22", "position": "Support Lead", "salary": "342000", "start_date": "2013/03/03", "extn": "9497", "email": "q.flynn@datatables.net", "office": "Edinburgh" }, { "id": "13", "sequence": 14, "first_name": "Charde", "last_name": "Marshall", "age": "36", "position": "Regional Director", "salary": "470600", "start_date": "2008/10/16", "extn": "6741", "email": "c.marshall@datatables.net", "office": "San Francisco" }, { "id": "14", "sequence": 12, "first_name": "Haley", "last_name": "Kennedy", "age": "43", "position": "Senior Marketing Designer", "salary": "313500", "start_date": "2012/12/18", "extn": "3597", "email": "h.kennedy@datatables.net", "office": "London" }, { "id": "15", "sequence": 54, "first_name": "Tatyana", "last_name": "Fitzpatrick", "age": "19", "position": "Regional Director", "salary": "385750", "start_date": "2010/03/17", "extn": "1965", "email": "t.fitzpatrick@datatables.net", "office": "London" }, { "id": "16", "sequence": 37, "first_name": "Michael", "last_name": "Silva", "age": "66", "position": "Marketing Designer", "salary": "198500", "start_date": "2012/11/27", "extn": "1581", "email": "m.silva@datatables.net", "office": "London" }, { "id": "17", "sequence": 32, "first_name": "Paul", "last_name": "Byrd", "age": "64", "position": "Chief Financial Officer (CFO)", "salary": "725000", "start_date": "2010/06/09", "extn": "3059", "email": "p.byrd@datatables.net", "office": "New York" }, { "id": "18", "sequence": 35, "first_name": "Gloria", "last_name": "Little", "age": "59", "position": "Systems Administrator", "salary": "237500", "start_date": "2009/04/10", "extn": "1721", "email": "g.little@datatables.net", "office": "New York" }, { "id": "19", "sequence": 48, "first_name": "Bradley", "last_name": "Greer", "age": "41", "position": "Software Engineer", "salary": "132000", "start_date": "2012/10/13", "extn": "2558", "email": "b.greer@datatables.net", "office": "London" }, { "id": "20", "sequence": 45, "first_name": "Dai", "last_name": "Rios", "age": "35", "position": "Personnel Lead", "salary": "217500", "start_date": "2012/09/26", "extn": "2290", "email": "d.rios@datatables.net", "office": "Edinburgh" }, { "id": "21", "sequence": 17, "first_name": "Jenette", "last_name": "Caldwell", "age": "30", "position": "Development Lead", "salary": "345000", "start_date": "2011/09/03", "extn": "1937", "email": "j.caldwell@datatables.net", "office": "New York" }, { "id": "22", "sequence": 57, "first_name": "Yuri", "last_name": "Berry", "age": "40", "position": "Chief Marketing Officer (CMO)", "salary": "675000", "start_date": "2009/06/25", "extn": "6154", "email": "y.berry@datatables.net", "office": "New York" }, { "id": "23", "sequence": 29, "first_name": "Caesar", "last_name": "Vance", "age": "21", "position": "Pre-Sales Support", "salary": "106450", "start_date": "2011/12/12", "extn": "8330", "email": "c.vance@datatables.net", "office": "New York" }, { "id": "24", "sequence": 56, "first_name": "Doris", "last_name": "Wilder", "age": "23", "position": "Sales Assistant", "salary": "85600", "start_date": "2010/09/20", "extn": "3023", "email": "d.wilder@datatables.net", "office": "Sidney" }, { "id": "25", "sequence": 36, "first_name": "Angelica", "last_name": "Ramos", "age": "47", "position": "Chief Executive Officer (CEO)", "salary": "1200000", "start_date": "2009/10/09", "extn": "5797", "email": "a.ramos@datatables.net", "office": "London" }, { "id": "26", "sequence": 5, "first_name": "Gavin", "last_name": "Joyce", "age": "42", "position": "Developer", "salary": "92575", "start_date": "2010/12/22", "extn": "8822", "email": "g.joyce@datatables.net", "office": "Edinburgh" }, { "id": "27", "sequence": 51, "first_name": "Jennifer", "last_name": "Chang", "age": "28", "position": "Regional Director", "salary": "357650", "start_date": "2010/11/14", "extn": "9239", "email": "j.chang@datatables.net", "office": "Singapore" }, { "id": "28", "sequence": 20, "first_name": "Brenden", "last_name": "Wagner", "age": "28", "position": "Software Engineer", "salary": "206850", "start_date": "2011/06/07", "extn": "1314", "email": "b.wagner@datatables.net", "office": "San Francisco" }, { "id": "29", "sequence": 7, "first_name": "Fiona", "last_name": "Green", "age": "48", "position": "Chief Operating Officer (COO)", "salary": "850000", "start_date": "2010/03/11", "extn": "2947", "email": "f.green@datatables.net", "office": "San Francisco" }, { "id": "30", "sequence": 1, "first_name": "Shou", "last_name": "Itou", "age": "20", "position": "Regional Marketing", "salary": "163000", "start_date": "2011/08/14", "extn": "8899", "email": "s.itou@datatables.net", "office": "Tokyo" }, { "id": "31", "sequence": 39, "first_name": "Michelle", "last_name": "House", "age": "37", "position": "Integration Specialist", "salary": "95400", "start_date": "2011/06/02", "extn": "2769", "email": "m.house@datatables.net", "office": "Sidney" }, { "id": "32", "sequence": 40, "first_name": "Suki", "last_name": "Burks", "age": "53", "position": "Developer", "salary": "114500", "start_date": "2009/10/22", "extn": "6832", "email": "s.burks@datatables.net", "office": "London" }, { "id": "33", "sequence": 47, "first_name": "Prescott", "last_name": "Bartlett", "age": "27", "position": "Technical Author", "salary": "145000", "start_date": "2011/05/07", "extn": "3606", "email": "p.bartlett@datatables.net", "office": "London" }, { "id": "34", "sequence": 52, "first_name": "Gavin", "last_name": "Cortez", "age": "22", "position": "Team Leader", "salary": "235500", "start_date": "2008/10/26", "extn": "2860", "email": "g.cortez@datatables.net", "office": "San Francisco" }, { "id": "35", "sequence": 8, "first_name": "Martena", "last_name": "Mccray", "age": "46", "position": "Post-Sales support", "salary": "324050", "start_date": "2011/03/09", "extn": "8240", "email": "m.mccray@datatables.net", "office": "Edinburgh" }, { "id": "36", "sequence": 24, "first_name": "Unity", "last_name": "Butler", "age": "47", "position": "Marketing Designer", "salary": "85675", "start_date": "2009/12/09", "extn": "5384", "email": "u.butler@datatables.net", "office": "San Francisco" }, { "id": "37", "sequence": 38, "first_name": "Howard", "last_name": "Hatfield", "age": "51", "position": "Office Manager", "salary": "164500", "start_date": "2008/12/16", "extn": "7031", "email": "h.hatfield@datatables.net", "office": "San Francisco" }, { "id": "38", "sequence": 53, "first_name": "Hope", "last_name": "Fuentes", "age": "41", "position": "Secretary", "salary": "109850", "start_date": "2010/02/12", "extn": "6318", "email": "h.fuentes@datatables.net", "office": "San Francisco" }, { "id": "39", "sequence": 30, "first_name": "Vivian", "last_name": "Harrell", "age": "62", "position": "Financial Controller", "salary": "452500", "start_date": "2009/02/14", "extn": "9422", "email": "v.harrell@datatables.net", "office": "San Francisco" }, { "id": "40", "sequence": 28, "first_name": "Timothy", "last_name": "Mooney", "age": "37", "position": "Office Manager", "salary": "136200", "start_date": "2008/12/11", "extn": "7580", "email": "t.mooney@datatables.net", "office": "London" }, { "id": "41", "sequence": 34, "first_name": "Jackson", "last_name": "Bradshaw", "age": "65", "position": "Director", "salary": "645750", "start_date": "2008/09/26", "extn": "1042", "email": "j.bradshaw@datatables.net", "office": "New York" }, { "id": "42", "sequence": 4, "first_name": "Olivia", "last_name": "Liang", "age": "64", "position": "Support Engineer", "salary": "234500", "start_date": "2011/02/03", "extn": "2120", "email": "o.liang@datatables.net", "office": "Singapore" }, { "id": "43", "sequence": 3, "first_name": "Bruno", "last_name": "Nash", "age": "38", "position": "Software Engineer", "salary": "163500", "start_date": "2011/05/03", "extn": "6222", "email": "b.nash@datatables.net", "office": "London" }, { "id": "44", "sequence": 31, "first_name": "Sakura", "last_name": "Yamamoto", "age": "37", "position": "Support Engineer", "salary": "139575", "start_date": "2009/08/19", "extn": "9383", "email": "s.yamamoto@datatables.net", "office": "Tokyo" }, { "id": "45", "sequence": 11, "first_name": "Thor", "last_name": "Walton", "age": "61", "position": "Developer", "salary": "98540", "start_date": "2013/08/11", "extn": "8327", "email": "t.walton@datatables.net", "office": "New York" }, { "id": "46", "sequence": 10, "first_name": "Finn", "last_name": "Camacho", "age": "47", "position": "Support Engineer", "salary": "87500", "start_date": "2009/07/07", "extn": "2927", "email": "f.camacho@datatables.net", "office": "San Francisco" }, { "id": "47", "sequence": 44, "first_name": "Serge", "last_name": "Baldwin", "age": "64", "position": "Data Coordinator", "salary": "138575", "start_date": "2012/04/09", "extn": "8352", "email": "s.baldwin@datatables.net", "office": "Singapore" }, { "id": "48", "sequence": 42, "first_name": "Zenaida", "last_name": "Frank", "age": "63", "position": "Software Engineer", "salary": "125250", "start_date": "2010/01/04", "extn": "7439", "email": "z.frank@datatables.net", "office": "New York" }, { "id": "49", "sequence": 27, "first_name": "Zorita", "last_name": "Serrano", "age": "56", "position": "Software Engineer", "salary": "115000", "start_date": "2012/06/01", "extn": "4389", "email": "z.serrano@datatables.net", "office": "San Francisco" }, { "id": "50", "sequence": 49, "first_name": "Jennifer", "last_name": "Acosta", "age": "43", "position": "Junior Javascript Developer", "salary": "75650", "start_date": "2013/02/01", "extn": "3431", "email": "j.acosta@datatables.net", "office": "Edinburgh" }, { "id": "51", "sequence": 15, "first_name": "Cara", "last_name": "Stevens", "age": "46", "position": "Sales Assistant", "salary": "145600", "start_date": "2011/12/06", "extn": "3990", "email": "c.stevens@datatables.net", "office": "New York" }, { "id": "52", "sequence": 9, "first_name": "Hermione", "last_name": "Butler", "age": "47", "position": "Regional Director", "salary": "356250", "start_date": "2011/03/21", "extn": "1016", "email": "h.butler@datatables.net", "office": "London" }, { "id": "53", "sequence": 25, "first_name": "Lael", "last_name": "Greer", "age": "21", "position": "Systems Administrator", "salary": "103500", "start_date": "2009/02/27", "extn": "6733", "email": "l.greer@datatables.net", "office": "London" }, { "id": "54", "sequence": 33, "first_name": "Jonas", "last_name": "Alexander", "age": "30", "position": "Developer", "salary": "86500", "start_date": "2010/07/14", "extn": "8196", "email": "j.alexander@datatables.net", "office": "San Francisco" }, { "id": "55", "sequence": 43, "first_name": "Shad", "last_name": "Decker", "age": "51", "position": "Regional Director", "salary": "183000", "start_date": "2008/11/13", "extn": "6373", "email": "s.decker@datatables.net", "office": "Edinburgh" }, { "id": "56", "sequence": 16, "first_name": "Michael", "last_name": "Bruce", "age": "29", "position": "Javascript Developer", "salary": "183000", "start_date": "2011/06/27", "extn": "5384", "email": "m.bruce@datatables.net", "office": "Singapore" }, { "id": "57", "sequence": 19, "first_name": "Donna", "last_name": "Snider", "age": "27", "position": "Customer Support", "salary": "112000", "start_date": "2011/01/25", "extn": "4226", "email": "d.snider@datatables.net", "office": "New York" } ]DataTablesSrc-1.10.11/build/examples.php000066400000000000000000000733551265711500300177720ustar00rootroot00000000000000 "Basic initialisation", 'advanced_init' => "Advanced initialisation", 'styling' => "Styling", 'data_sources' => "Data sources", 'api' => "API", 'ajax' => "Ajax", 'server_side' => "Server-side", 'plug-ins' => "Plug-ins" ); // for extensions example ordering, see below /* * Command line options */ $shortopts = "c:"; // CSS library (added to the predefined libraries) $shortopts .= "j:"; // JS library (added to the predefined libraries) $shortopts .= "l:"; // Libraries to add to the XML library list $shortopts .= "m:"; // Media library (DataTables and jQuery) $shortopts .= "o:"; // Input / Output directory (replaces the XML files) $shortopts .= "t:"; // Example template $shortopts .= "u:"; // Example index template $shortopts .= "d"; // Do not create data files $shortopts .= "r:"; // Example directory order (`$dir_order`) $longopts = array( "cdn", "css:", "js:", "libs:", "media:", "output:", "template:", "index-template:", "no-data-files", "order:" ); $options = getopt( $shortopts, $longopts ); /* * Initial settings */ $create_data_files = true; $dir_input = ''; $dir_media = ''; $file_index_template = ''; $file_example_template = ''; $additional_libs = array( 'css' => array(), 'js' => array() ); if ( isset( $options['m'] ) ) { $dir_media = $options['m']; } else if ( isset( $options['media'] ) ) { $dir_media = $options['media']; } // Default libraries $versions = json_decode( file_get_contents( is_file('/tmp/dt-versions') ? '/tmp/dt-versions' : 'http://datatables.net/feeds/versions.php' ), true ); $pluginsHash = $versions['Plugins']['release']['version']; DT_Example::$components_cdn = isset( $options['cdn'] ); DT_Example::$components['datatables'] = [ 'path' => path_simplify( $dir_media ), 'release' => $versions['DataTables']['release']['version'], 'filename' => 'dataTables', 'framework' => [ 'css' => true, 'js' => true ] ]; DT_Example::$components['autofill'] = [ 'path' => path_simplify( $dir_media.'/../extensions/AutoFill' ), 'release' => $versions['AutoFill']['release']['version'], 'filename' => 'autoFill', 'framework' => [ 'css' => true, 'js' => true ] ]; DT_Example::$components['buttons'] = [ 'path' => path_simplify( $dir_media.'/../extensions/Buttons' ), 'release' => $versions['Buttons']['release']['version'], 'filename' => 'buttons', 'framework' => [ 'css' => true, 'js' => true ] ]; DT_Example::$components['colreorder'] = [ 'path' => path_simplify( $dir_media.'/../extensions/ColReorder' ), 'release' => $versions['ColReorder']['release']['version'], 'filename' => 'colReorder', 'framework' => [ 'css' => true, 'js' => false ] ]; DT_Example::$components['editor'] = [ 'path' => path_simplify( $dir_media.'/../extensions/Editor' ), 'release' => $versions['Editor']['release']['version'], 'filename' => 'editor', 'framework' => [ 'css' => true, 'js' => true ] ]; DT_Example::$components['fixedcolumns'] = [ 'path' => path_simplify( $dir_media.'/../extensions/FixedColumns' ), 'release' => $versions['FixedColumns']['release']['version'], 'filename' => 'fixedColumns', 'framework' => [ 'css' => true, 'js' => false ] ]; DT_Example::$components['fixedheader'] = [ 'path' => path_simplify( $dir_media.'/../extensions/FixedHeader' ), 'release' => $versions['FixedHeader']['release']['version'], 'filename' => 'fixedHeader', 'framework' => [ 'css' => true, 'js' => false ] ]; DT_Example::$components['keytable'] = [ 'path' => path_simplify( $dir_media.'/../extensions/KeyTable' ), 'release' => $versions['KeyTable']['release']['version'], 'filename' => 'keyTable', 'framework' => [ 'css' => true, 'js' => false ] ]; DT_Example::$components['responsive'] = [ 'path' => path_simplify( $dir_media.'/../extensions/Responsive' ), 'release' => $versions['Responsive']['release']['version'], 'filename' => 'responsive', 'framework' => [ 'css' => true, 'js' => true ] ]; DT_Example::$components['rowreorder'] = [ 'path' => path_simplify( $dir_media.'/../extensions/RowReorder' ), 'release' => $versions['RowReorder']['release']['version'], 'filename' => 'rowReorder', 'framework' => [ 'css' => true, 'js' => false ] ]; DT_Example::$components['scroller'] = [ 'path' => path_simplify( $dir_media.'/../extensions/Scroller' ), 'release' => $versions['Scroller']['release']['version'], 'filename' => 'scroller', 'framework' => [ 'css' => true, 'js' => false ] ]; DT_Example::$components['select'] = [ 'path' => path_simplify( $dir_media.'/../extensions/Select' ), 'release' => $versions['Select']['release']['version'], 'filename' => 'select', 'framework' => [ 'css' => true, 'js' => false ] ]; // Legacy extensions if ( isset( $options['cdn'] ) ) { DT_Example::$lookup_libraries['css']['colvis'] = '//cdn.datatables.net/colvis/'.$versions['ColVis']['release']['version'].'/css/dataTables.colVis.css'; DT_Example::$lookup_libraries['js' ]['colvis'] = '//cdn.datatables.net/colvis/'.$versions['ColVis']['release']['version'].'/js/dataTables.colVis.min.js'; DT_Example::$lookup_libraries['css']['tabletools'] = '//cdn.datatables.net/tabletools/'.$versions['TableTools']['release']['version'].'/css/dataTables.tableTools.css'; DT_Example::$lookup_libraries['js' ]['tabletools'] = '//cdn.datatables.net/tabletools/'.$versions['TableTools']['release']['version'].'/js/dataTables.tableTools.min.js'; DT_Example::$lookup_libraries['js' ]['buttons-flash'] = '//cdn.datatables.net/buttons/'.$versions['Buttons']['release']['version'].'/js/buttons.flash.min.js'; DT_Example::$lookup_libraries['js' ]['buttons-html5'] = '//cdn.datatables.net/buttons/'.$versions['Buttons']['release']['version'].'/js/buttons.html5.min.js'; DT_Example::$lookup_libraries['js' ]['buttons-colvis'] = '//cdn.datatables.net/buttons/'.$versions['Buttons']['release']['version'].'/js/buttons.colVis.min.js'; DT_Example::$lookup_libraries['js' ]['buttons-print'] = '//cdn.datatables.net/buttons/'.$versions['Buttons']['release']['version'].'/js/buttons.print.min.js'; } else { DT_Example::$lookup_libraries['css']['colvis'] = path_simplify( $dir_media.'/../extensions/ColVis/css/dataTables.colVis.css' ); DT_Example::$lookup_libraries['js' ]['colvis'] = path_simplify( $dir_media.'/../extensions/ColVis/js/dataTables.colVis.js' ); DT_Example::$lookup_libraries['css']['tabletools'] = path_simplify( $dir_media.'/../extensions/TableTools/css/dataTables.tableTools.css' ); DT_Example::$lookup_libraries['js' ]['tabletools'] = path_simplify( $dir_media.'/../extensions/TableTools/js/dataTables.tableTools.js' ); DT_Example::$lookup_libraries['js' ]['buttons-flash'] = path_simplify( $dir_media.'/../extensions/Buttons/js/buttons.flash.js' ); DT_Example::$lookup_libraries['js' ]['buttons-html5'] = path_simplify( $dir_media.'/../extensions/Buttons/js/buttons.html5.js' ); DT_Example::$lookup_libraries['js' ]['buttons-print'] = path_simplify( $dir_media.'/../extensions/Buttons/js/buttons.print.js' ); DT_Example::$lookup_libraries['js' ]['buttons-colvis'] = path_simplify( $dir_media.'/../extensions/Buttons/js/buttons.colVis.js' ); } // Styling libraries DT_Example::$lookup_libraries['js' ]['jquery'] = '//code.jquery.com/jquery-1.12.0.min.js'; DT_Example::$lookup_libraries['js' ]['jqueryui'] = '//code.jquery.com/ui/1.11.3/jquery-ui.js'; DT_Example::$lookup_libraries['css']['jqueryui'] = '//code.jquery.com/ui/1.11.3/themes/smoothness/jquery-ui.css'; DT_Example::$lookup_libraries['js' ]['bootstrap'] = '//maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js'; DT_Example::$lookup_libraries['css']['bootstrap'] = '//maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css'; DT_Example::$lookup_libraries['js']['bootstrap4'] = '//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha.2/js/bootstrap.min.js'; DT_Example::$lookup_libraries['css' ]['bootstrap4'] = '//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha.2/css/bootstrap.css'; DT_Example::$lookup_libraries['js' ]['semanticui'] = '//cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.1.8/semantic.min.js'; DT_Example::$lookup_libraries['css']['semanticui'] = '//cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.1.8/semantic.min.css'; DT_Example::$lookup_libraries['js' ]['material'] = '//cdnjs.cloudflare.com/ajax/libs/material-design-lite/1.1.0/material.min.js'; DT_Example::$lookup_libraries['css']['material'] = '//cdnjs.cloudflare.com/ajax/libs/material-design-lite/1.1.0/material.min.css'; DT_Example::$lookup_libraries['js' ]['foundation'] = '//cdnjs.cloudflare.com/ajax/libs/foundation/6.1.1/foundation.min.js'; DT_Example::$lookup_libraries['css']['foundation'] = '//cdnjs.cloudflare.com/ajax/libs/foundation/6.1.1/foundation.min.css'; DT_Example::$lookup_libraries['js' ]['foundation'] = '//cdnjs.cloudflare.com/ajax/libs/foundation/5.5.2/js/foundation.min.js'; DT_Example::$lookup_libraries['css']['foundation'] = '//cdnjs.cloudflare.com/ajax/libs/foundation/5.5.2/css/foundation.min.css'; DT_Example::$lookup_libraries['js' ]['uikit'] = '//cdnjs.cloudflare.com/ajax/libs/uikit/2.24.3/js/uikit.min.js'; DT_Example::$lookup_libraries['css']['uikit'] = '//cdnjs.cloudflare.com/ajax/libs/uikit/2.24.3/css/uikit.min.css'; DT_Example::$lookup_libraries['css']['font-awesome'] = '//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.4.0/css/font-awesome.min.css'; DT_Example::$lookup_libraries['js']['jszip'] = '//cdnjs.cloudflare.com/ajax/libs/jszip/2.5.0/jszip.min.js'; DT_Example::$lookup_libraries['js']['pdfmake'] = '//cdn.rawgit.com/bpampuch/pdfmake/0.1.18/build/pdfmake.min.js'; DT_Example::$lookup_libraries['js']['vfsfonts'] = '//cdn.rawgit.com/bpampuch/pdfmake/0.1.18/build/vfs_fonts.js'; DT_Example::$lookup_libraries['js']['moment'] = '//cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.6/moment.min.js'; function multiple ( $value, $fn ) { if ( is_array( $value ) ) { for ( $i=0, $ien=count($value) ; $i<$ien ; $i++ ) { $fn( $value[$i] ); } } else { $fn( $value ); } } /* * Command line options */ foreach ($options as $key => $value) { switch( $key ) { case "c": case "css": multiple( $value, function ( $val ) { $a = explode(':', $val); if ( strpos($a[1], '//') === 0 ) { DT_Example::$lookup_libraries['css'][$a[0]] = $a[1]; } else { $get = explode('?', $a[1]); DT_Example::$lookup_libraries['css'][$a[0]] = realpath( $get[0] ).( count($get)>1 ? '?'.$get[1] : '' ); } } ); break; case "j": case "js": multiple( $value, function ( $val ) { $a = explode(':', $val); if ( strpos($a[1], '//') === 0 ) { DT_Example::$lookup_libraries['js'][$a[0]] = $a[1]; } else { $get = explode('?', $a[1]); DT_Example::$lookup_libraries['js'][$a[0]] = realpath( $get[0] ).( count($get)>1 ? '?'.$get[1] : '' ); } } ); break; case "l": case "libs": $a = explode(' ', $value); for ( $i=0 ; $i 'Simple initialisation', 'advanced' => 'Advanced initialisation', 'extensions' => 'DataTables extensions', 'dates' => "Dates and time", 'bubble-editing' => 'Bubble editing', 'inline-editing' => 'Inline editing', 'api' => 'API', 'standalone' => 'Standalone', 'styling' => 'Styling', 'plug-ins' => 'Plug-ins' ); } else if ( stripos( $dir_input, 'Buttons' ) ) { $dir_order = array( 'initialisation', 'html5', 'flash', 'column_visibility', 'print', 'api', 'styling' ); $dir_names = array( 'initialisation' => "Basic initialisation", 'html5' => "HTML 5 data export", 'flash' => "Flash data export", 'column_visibility' => 'Column visibility', 'print' => 'Print', 'api' => 'API', 'styling' => "Styling", ); } else if ( stripos( $dir_input, 'ColReorder' ) ) { $dir_order = array( 'initialisation', 'integration', 'styling' ); $dir_names = array( 'initialisation' => "Initialisation and options", 'integration' => "Integration with other DataTables extensions", 'styling' => "Styling" ); } else if ( stripos( $dir_input, 'Responsive' ) ) { $dir_order = array( 'initialisation', 'display-types', 'column-control', 'child-rows', 'styling' ); $dir_names = array( 'initialisation' => "Basic initialisation", 'display-control' => "Display control", 'child-rows' => "Child rows", 'styling' => "Styling" ); } else if ( stripos( $dir_input, 'FixedHeader' ) ) { $dir_order = array( 'options', 'styling', 'integration' ); $dir_names = array( 'options' => "Initialisation and options", 'styling' => "Styling", 'integration' => "Integration with other DataTables extensions" ); } else if ( stripos( $dir_input, 'FixedColumns' ) ) { $dir_order = array( 'initialisation', 'integration', 'styling' ); $dir_names = array( 'initialisation' => "Initialisation and options", 'integration' => "Integration with other DataTables extensions", 'styling' => "Styling" ); } //print_r( DT_Example::$lookup_libraries ); // Structure // "type" => "file", // "src" => "...", // "title" => "...", // "name" => "...", // "data" => DT_Example, // "order" => int // // "type" => "dir", // "files" => array() // "name" => "..." $examples = array(); // Read the files into the examples array read_structure( $examples, $dir_input, $file_index_template, $file_example_template, $additional_libs ); // Remove any directories without examples tidy_structure( $examples, $dir_order ); toc_structure( $examples ); process_structure( $examples ); if ( $create_data_files ) { json_files( $dir_input ); sql_files( $dir_input ); } //dump_structure( $examples ); // Create the SQL files needed for the Ajax examples - need to create files for // all of the database types supported by Editor function sql_files ( $out_dir ) { $out_dir = $out_dir.'/server_side/scripts'; $json = json_decode( file_get_contents( dirname(__FILE__).'/data.json' ), true ); $out = []; for ( $i=0, $ien=count($json) ; $i<$ien ; $i++ ) { $out[] = "( ". $json[$i]['id'].", ". "'".$json[$i]['first_name']."', ". "'".$json[$i]['last_name']."', ". $json[$i]['age'].", ". "'".$json[$i]['position']."', ". $json[$i]['salary'].", ". "'".$json[$i]['start_date']."', ". $json[$i]['extn'].", ". "'".$json[$i]['email']."', ". "'".$json[$i]['office']."', ". $json[$i]['sequence']." ". ")"; } $values = join( ",\n\t\t", $out ); // MySQL style $str = << $out ), JSON_PRETTY_PRINT ) ); // Custom property file_put_contents( $out_dir.'/arrays_custom_prop.txt', json_encode( array( 'demo' => $out ), JSON_PRETTY_PRINT ) ); // Arrays with sub objects $out = []; for ( $i=0, $ien=count($json) ; $i<$ien ; $i++ ) { $out[] = [ $json[$i]['first_name'].' '.$json[$i]['last_name'], 'hr' => [ 'position' => $json[$i]['position'], 'salary' => '$'.number_format($json[$i]['salary']), 'start_date' => $json[$i]['start_date'] ], 'contact' => [ 'office' => $json[$i]['office'], 'extn' => $json[$i]['extn'] ] ]; } file_put_contents( $out_dir.'/arrays_subobjects.txt', json_encode( array( 'data' => $out ), JSON_PRETTY_PRINT ) ); // Simple object base case $out = []; for ( $i=0, $ien=count($json) ; $i<$ien ; $i++ ) { $out[] = [ 'name' => $json[$i]['first_name'] .' '. $json[$i]['last_name'], 'position' => $json[$i]['position'], 'salary' => '$'.number_format($json[$i]['salary']), 'start_date' => $json[$i]['start_date'], 'office' => $json[$i]['office'], 'extn' => $json[$i]['extn'] ]; } file_put_contents( $out_dir.'/objects.txt', json_encode( array( 'data' => $out ), JSON_PRETTY_PRINT ) ); // Objects with no nested property file_put_contents( $out_dir.'/objects_root_array.txt', json_encode( $out, JSON_PRETTY_PRINT ) ); // Objects with sub objects and arrays $out = []; for ( $i=0, $ien=count($json) ; $i<$ien ; $i++ ) { $out[] = [ 'name' => $json[$i]['first_name'].' '.$json[$i]['last_name'], 'hr' => [ 'position' => $json[$i]['position'], 'salary' => '$'.number_format($json[$i]['salary']), 'start_date' => $json[$i]['start_date'] ], 'contact' => [ $json[$i]['office'], $json[$i]['extn'] ] ]; } file_put_contents( $out_dir.'/objects_deep.txt', json_encode( array( 'data' => $out ), JSON_PRETTY_PRINT ) ); // Objects with sub objects $out = []; for ( $i=0, $ien=count($json) ; $i<$ien ; $i++ ) { $out[] = [ 'name' => [ $json[$i]['last_name'], $json[$i]['first_name'] ], 'hr' => [ $json[$i]['position'], '$'.number_format($json[$i]['salary']), $json[$i]['start_date'] ], 'office' => $json[$i]['office'], 'extn' => $json[$i]['extn'] ]; } file_put_contents( $out_dir.'/objects_subarrays.txt', json_encode( array( 'data' => $out ), JSON_PRETTY_PRINT ) ); // Orthogonal date data $out = []; for ( $i=0, $ien=count($json) ; $i<$ien ; $i++ ) { $t = strtotime( $json[$i]['start_date'] ); $out[] = [ 'name' => $json[$i]['first_name'] .' '. $json[$i]['last_name'], 'position' => $json[$i]['position'], 'salary' => '$'.number_format($json[$i]['salary']), 'start_date' => array( 'display' => date('D jS M y', $t), 'timestamp' => date('U', $t) ), 'office' => $json[$i]['office'], 'extn' => $json[$i]['extn'] ]; } file_put_contents( $out_dir.'/orthogonal.txt', json_encode( array( 'data' => $out ), JSON_PRETTY_PRINT ) ); } function read_structure ( &$examples, $dir, $index_template, $example_template, $additional_libs ) { global $dir_names; $dh = opendir( $dir ); if ( $dh === false ) { echo "Warning: Can't read: $dir\n"; return; } while (($file = readdir($dh)) !== false) { if ( $file == '.' || $file == '..' ) { continue; } $fileParts = pathinfo( $file ); if ( is_dir( $dir.'/'.$file ) ) { $sub = array( 'type' => 'dir', 'name' => $file, 'order' => 0, 'files' => array(), 'toc' => '', 'title' => isset($dir_names[$file]) ? $dir_names[$file] : ucwords( str_replace('_', ' ', $file) ), 'path' => $dir ); read_structure( $sub['files'], $dir.'/'.$file, $index_template, $example_template, $additional_libs ); $examples[] = $sub; } else if ( isset($fileParts['extension']) && $fileParts['extension'] === 'xml' ) { $example = new DT_Example( $dir.'/'.$file, $fileParts['filename'] === 'index' ? $index_template : $example_template, function ( $path ) use ( $dir, $fileParts ) { return path_resolve( $dir.'/'.$fileParts['filename'].'.html', $path ); }, $additional_libs ); $examples[] = array( 'type' => 'file', 'name' => $fileParts['filename'], 'data' => $example, 'title' => $example->title(), 'order' => $example->order(), 'path' => $dir ); } } closedir( $dh ); } function tidy_structure ( &$examples, $order ) { for ( $i=count($examples)-1 ; $i>=0 ; $i-- ) { if ( $examples[$i]['type'] === 'dir' && count($examples[$i]['files']) === 0 ) { // Remove any directories which are empty array_splice( $examples, $i, 1 ); } else if ( $examples[$i]['type'] === 'dir' && ! has_files( $examples[$i]['files'] ) ) { // Remove any directories have only directories for children array_splice( $examples, $i, 1 ); } else if ( $examples[$i]['type'] === 'dir' ) { tidy_structure( $examples[$i]['files'], $order ); // Order the examples usort( $examples[$i]['files'], function ($a, $b) { if ( $a['order'] === $b['order'] ) { return 0; } return ($a['order'] < $b['order']) ? -1 : 1; } ); } } // Order the top level directories usort( $examples, function ( $a, $b ) use( $order ) { //if ( $a['type'] === 'file' && $b['type'] === 'file' ) { // return 0; //} //else if ( $a['type'] === 'file' || $b['type'] === 'file' ) { // return -1; //} //else { $idxA = array_search( $a['name'], $order ); $idxB = array_search( $b['name'], $order ); return $idxA === $idxB ? 0 : $idxA < $idxB ? -1 : 1; //} } ); } function dump_structure( &$examples, $pre="" ) { for ( $i=0, $ien=count($examples) ; $i<$ien ; $i++ ) { $example = $examples[$i]; if ( $example['type'] === 'dir' ) { echo $pre.' / '.$example['name']."\n"; dump_structure( $example['files'], $pre.' ' ); } else { echo $pre.' - '.$example['order'].'. '.$example['title']."\n"; } } } function process_structure ( &$examples, $toc='', $cat='' ) { for ( $i=0, $ien=count($examples) ; $i<$ien ; $i++ ) { $example = $examples[$i]; if ( $example['type'] === 'dir' ) { for ( $j=0, $jen=count($example['files']) ; $j<$jen ; $j++ ) { $subexample = $example['files'][$j]; process_example( $examples, $subexample, $example ); } } else { process_example( $examples, $example ); } } } function process_example ( &$examples, $example, $category=null ) { try { // echo 'Want to write '.$example['name'].' to '.$example['path']."\n"; $built = $example['data']->transform( array( 'toc' => build_toc( $examples, $example, $category ) ) ); file_put_contents( $example['path'].'/'.$example['name'].'.html', $built ); } catch( Exception $e ) { echo 'ERROR: '.$category['name'].'/'.$example['name'].' '.$e->getMessage()."\n"; } unlink( $example['path'].'/'.$example['name'].'.xml' ); } function build_toc ( $examples, $example, $category ) { if ( $example['name'] === 'index' && $category !== null ) { // Restrict to just the category return build_toc_category( $category, $example ); } else { // Use all examples $out = ''; for ( $i=0, $ien=count($examples) ; $i<$ien ; $i++ ) { if ( $examples[$i]['type'] === 'dir' && $examples[$i]['name'] !== 'private' ) { $out .= build_toc_category( $examples[$i], $example ); } } return $out; } } function build_toc_category ( $category, $current=null ) { $inCategory = false; $out = ''; for ( $i=0, $ien=count($category['files']) ; $i<$ien ; $i++ ) { $example = $category['files'][$i]; if ( $example['name'] !== 'index' ) { $class = ''; if ( $example === $current ) { $class = ' class="active"'; $inCategory = true; } $link = ''; if ( $current ) { $link = path_resolve( $current['path'].'/'.$current['name'].'.html', $example['path'].'/'.$example['name'].'.html' ) ."\n"; } $out .= ''.$example['title'].''; } } $link = ''; if ( $current ) { $link = path_resolve( $current['path'].'/'.$current['name'].'.html', $category['path'].'/'.$category['name'].'/index.html' ) ."\n"; } return '
'. '

'.$category['title'].'

'. '
    '.$out.'
'. '
'; } function has_files ( $files ) { for ( $i=0, $ien=count($files) ; $i<$ien ; $i++ ) { if ( $files[$i]['type'] === 'file' ) { return true; } } return false; } function toc_structure ( &$examples ) { for ( $i=0, $ien=count($examples) ; $i<$ien ; $i++ ) { $group = &$examples[$i]; if ( $group['type'] === 'dir' ) { $files = $group['files']; $toc = ''; for ( $j=0, $jen=count($files) ; $j<$jen ; $j++ ) { $toc .= '
  • '. $files[$j]['title']. '
  • '; } $group['toc'] = '

    '.$group['title'].'

    '. '
      '.$toc.'
    '; } } } function path_resolve( $from, $to ) { if ( ! $to ) { echo "Path - Empty to ($from)\n"; return ''; } $from = path_simplify( $from ); $to = path_simplify( $to ); // some compatibility fixes for Windows paths $from = is_dir($from) ? rtrim($from, '\/') . '/' : $from; $to = is_dir($to) ? rtrim($to, '\/') . '/' : $to; $from = str_replace('\\', '/', $from); $to = str_replace('\\', '/', $to); $from = explode('/', $from); $to = explode('/', $to); $relPath = $to; foreach ( $from as $depth => $dir ) { // find first non-matching dir if ( $dir === $to[$depth] ) { // ignore this directory array_shift($relPath); } else { // get number of remaining dirs to $from $remaining = count($from) - $depth; if ( $remaining > 1 ) { // add traversals up to first matching dir $padLength = (count($relPath) + $remaining - 1) * -1; $relPath = array_pad($relPath, $padLength, '..'); break; } else { $relPath[0] = './' . $relPath[0]; } } } if ( count($relPath) === 0 ) { return './'.$from[ count($from)-1 ]; } return implode('/', $relPath); } function path_simplify( $path ) { $out = array(); $a = explode('/', $path); for ( $i=count($a)-1 ; $i>= 0 ; $i-- ) { if ( $a[$i] !== '..' ) { array_unshift( $out, $a[$i] ); } else { // Skip the next path as well $i--; } } return implode( '/', $out); } DataTablesSrc-1.10.11/build/include.sh000066400000000000000000000123551265711500300174130ustar00rootroot00000000000000# # DataTables build environment variables and common functions # CLOSURE="/usr/local/closure_compiler/compiler.jar" JSHINT="/usr/bin/jshint" # CSS styling frameworks that DataTables supports FRAMEWORKS=( 'bootstrap' 'bootstrap4' 'foundation' 'jqueryui' 'semanticui' 'material' 'uikit' ) # $1 - string - file to get the version from function version_from_file { echo $(grep " * @version " $1 | awk -F" " '{ print $3 }') } # $1 - string - section name to echo function echo_section { # Cyan printf "\033[0;36m %s\033[0m \n" "$1" } # $1 - string - message to echo function echo_msg { # Green printf "\033[0;32m %s\033[0m \n" "$1" } # $1 - string - error to echo function echo_error { # Red printf "\033[0;31m %s\033[0m \n" "$1" } # Will compress a CSS file using SASS, saving the new file into the same # directory as the uncompressed file, but with `.min.css` as the extension. # # $1 - string - Full path to the file to compress function css_compress { # Only compresses CSS at the moment if [ -z "$DEBUG" ]; then FILE=$(basename $1 .css) DIR=$(dirname $1) echo_msg "CSS compressing $FILE.css" sass --scss --stop-on-error --style compressed $DIR/$FILE.css > $DIR/$FILE.min.css echo_msg " File size: $(ls -l $DIR/$FILE.min.css | awk -F" " '{ print $5 }')" fi } # Compile a SCSS file # # $1 - string - Full path to the file to compile function scss_compile { FILE=$(basename $1 .scss) DIR=$(dirname $1) echo_msg "SCSS compiling $FILE.scss" sass --scss --stop-on-error --style expanded $DIR/$FILE.scss > $DIR/$FILE.css css_compress $DIR/$FILE.css } # Compile SCSS files for a specific extension and the supported frameworks # # $1 - string - Extension name (camelCase) # $2 - string Build directory where the CSS files should be created function css_frameworks { EXTN=$1 DIR=$2 for FRAMEWORK in ${FRAMEWORKS[*]}; do if [ -e $DIR/$1.$FRAMEWORK.scss ]; then scss_compile $DIR/$EXTN.$FRAMEWORK.scss rm $DIR/$EXTN.$FRAMEWORK.scss fi done # DataTables isn't in the framework list for the Javascript aspect # Compile last as the other frameworks may include it as a base if [ -e $DIR/$1.dataTables.scss ]; then scss_compile $DIR/$EXTN.dataTables.scss rm $DIR/$EXTN.dataTables.scss fi } # Compress JS files for a specific extension and the supported frameworks # # $1 - string - Extension name (camelCase) # $2 - string Build directory where the JS min files should be created function js_frameworks { EXTN=$1 DIR=$2 for FRAMEWORK in ${FRAMEWORKS[*]}; do if [ -e $DIR/$1.$FRAMEWORK.js ]; then js_compress $DIR/$EXTN.$FRAMEWORK.js fi done } # Will compress a JS file using Closure compiler, saving the new file into the # same directory as the uncompressed file, but with `.min.js` as the extension. # # $1 - string - Full path to the file to compress # $2 - string - Enable ('on' - default) errors or disable ('off') function js_compress { LOG=$2 if [ -z "$DEBUG" ]; then FILE=$(basename $1 .js) DIR=$(dirname $1) echo_msg "JS compressing $FILE.js" # Closure Compiler doesn't support "important" comments so we add a # @license jsdoc comment to the license block to preserve it cp $DIR/$FILE.js /tmp/$FILE.js perl -i -0pe "s/^\/\*! (.*)$/\/** \@license \$1/s" /tmp/$FILE.js rm /tmp/closure_error.log java -jar $CLOSURE --charset 'utf-8' --js /tmp/$FILE.js > /tmp/$FILE.min.js 2> /tmp/closure_error.log if [ -e /tmp/closure_error.log ]; then if [ -z "$LOG" -o "$LOG" = "on" ]; then cat /tmp/closure_error.log fi fi # And add the important comment back in perl -i -0pe "s/^\/\*/\/*!/s" /tmp/$FILE.min.js mv /tmp/$FILE.min.js $DIR/$FILE.min.js rm /tmp/$FILE.js echo_msg " File size: $(ls -l $DIR/$FILE.min.js | awk -F" " '{ print $5 }')" fi } # $1 - string - Full path to input file # $2 - string - Full path to use for the output file function js_require { IN_FILE=$(basename $1) DIR=$(dirname $1) OUT=$2 CURR_DIR=$(pwd) cd $DIR OLD_IFS=$IFS IFS='%' cp $IN_FILE $IN_FILE.build grep "_buildInclude('" $IN_FILE.build > /dev/null while [ $? -eq 0 ]; do REQUIRE=$(grep "_buildInclude('" $IN_FILE.build | head -n 1) SPACER=$(echo ${REQUIRE} | cut -d _ -f 1) FILE=$(echo ${REQUIRE} | sed -e "s#^.*_buildInclude('##g" -e "s#');##") DIR=$(echo ${FILE} | cut -d \. -f 1) sed "s#^#${SPACER}#" < ${DIR}/${FILE} > ${DIR}/${FILE}.build sed -e "/${REQUIRE}/r ${DIR}/${FILE}.build" -e "/${REQUIRE}/d" < $IN_FILE.build > $IN_FILE.out mv $IN_FILE.out $IN_FILE.build rm ${DIR}/${FILE}.build grep "_buildInclude('" $IN_FILE.build > /dev/null done mv $IN_FILE.build $OUT IFS=$OLD_IFS cd $CURR_DIR } # Process XML example files into HTML files - in place! The XML files will be # removed. # # $1 - string - Path to the examples to processing - note that /examples is # added automatically function examples_process { php ${DT_SRC}/build/examples.php \ -d \ -o $1 \ -u ${DT_SRC}/build/templates/example_index.html \ -t ${DT_SRC}/build/templates/example.html \ -c "demo:${DT_BUILT}/examples/resources/demo.css" \ -j "demo:${DT_BUILT}/examples/resources/demo.js" \ -c "syntax:${DT_BUILT}/examples/resources/syntax/shCore.css" \ -j "syntax:${DT_BUILT}/examples/resources/syntax/shCore.js" \ -m "${DT_BUILT}/media" \ -l "css:syntax css:demo js:syntax js:demo" } DataTablesSrc-1.10.11/build/jshint.config000066400000000000000000000071151265711500300201200ustar00rootroot00000000000000{ // Settings "passfail" : false, // Stop on first error. "maxerr" : 100, // Maximum error before stopping. // Predefined globals whom JSHint will ignore. "browser" : true, // Standard browser globals e.g. `window`, `document`. "node" : false, "rhino" : false, "couch" : false, "wsh" : true, // Windows Scripting Host. "jquery" : true, "prototypejs" : false, "mootools" : false, "dojo" : false, "predef" : [ // Custom globals. //"exampleVar", //"anotherCoolGlobal", //"iLoveDouglas" ], // Development. "debug" : false, // Allow debugger statements e.g. browser breakpoints. "devel" : true, // Allow developments statements e.g. `console.log();`. // ECMAScript 5. "strict" : false, // Require `use strict` pragma in every file. "globalstrict" : false, // Allow global "use strict" (also enables 'strict'). // The Good Parts. "asi" : false, // Tolerate Automatic Semicolon Insertion (no semicolons). "laxbreak" : true, // Tolerate unsafe line breaks e.g. `return [\n] x` without semicolons. "bitwise" : true, // Prohibit bitwise operators (&, |, ^, etc.). "boss" : false, // Tolerate assignments inside if, for & while. Usually conditions & loops are for comparison, not assignments. "curly" : true, // Require {} for every new block or scope. "eqeqeq" : false, // Require triple equals i.e. `===`. "eqnull" : false, // Tolerate use of `== null`. "evil" : false, // Tolerate use of `eval`. "expr" : false, // Tolerate `ExpressionStatement` as Programs. "forin" : false, // Tolerate `for in` loops without `hasOwnPrototype`. "immed" : true, // Require immediate invocations to be wrapped in parens e.g. `( function(){}() );` "latedef" : true, // Prohipit variable use before definition. "loopfunc" : false, // Allow functions to be defined within loops. "noarg" : true, // Prohibit use of `arguments.caller` and `arguments.callee`. "regexp" : false, // Prohibit `.` and `[^...]` in regular expressions. "regexdash" : false, // Tolerate unescaped last dash i.e. `[-...]`. "scripturl" : true, // Tolerate script-targeted URLs. "shadow" : false, // Allows re-define variables later in code e.g. `var x=1; x=2;`. "supernew" : false, // Tolerate `new function () { ... };` and `new Object;`. "undef" : true, // Require all non-global variables be declared before they are used. // Personal styling preferences. "newcap" : false, // Require capitalization of all constructor functions e.g. `new F()`. "noempty" : true, // Prohibit use of empty blocks. "nonew" : true, // Prohibit use of constructors for side-effects. "nomen" : false, // Prohibit use of initial or trailing underbars in names. "onevar" : false, // Allow only one `var` statement per function. "plusplus" : false, // Prohibit use of `++` & `--`. "sub" : false, // Tolerate all forms of subscript notation besides dot notation e.g. `dict['key']` instead of `dict.key`. "trailing" : true, // Prohibit trailing whitespaces. "white" : false, // Check against strict whitespace and indentation rules. "indent" : false, // Specify indentation spacing "smarttabs" : true } DataTablesSrc-1.10.11/build/lib/000077500000000000000000000000001265711500300161745ustar00rootroot00000000000000DataTablesSrc-1.10.11/build/lib/DT_Example.php000066400000000000000000000657601265711500300207050ustar00rootroot00000000000000file( $file ); } if ( $template !== null ) { $this->template( $template ); } if ( $path_resolver !== null ) { $this->_path_resolver = $path_resolver; } $this->_libs = array( 'css' => array(), 'js' => array() ); $this->_xml_libs = array( 'css' => array(), 'js' => array() ); $this->_additional_libs = $libs; $this->_data = json_decode( file_get_contents( dirname(__FILE__).'/../data.json' ), true); } public function order () { $attrs = $this->_xml->attributes(); return isset( $attrs['order'] ) ? (int)$attrs['order'] : 1; } public function title () { return (string)$this->_xml->title; } public function file ( $file ) { if ( ! is_file( $file ) ) { throw new Exception("File $file not found", 1); } $this->_file = $file; $this->_xml = simplexml_load_file( $file ); } public function template ( $file ) { if ( ! is_file( $file ) ) { throw new Exception("Template $file not found", 1); } $this->_template = $file; } public function transform ( $opts ) { $xml = $this->_xml; $framework = isset( $xml['framework'] ) ? (string)$xml['framework'] : 'datatables'; $bodyClass = isset( $xml['body-class'] ) ? (string)$xml['body-class'] : ''; if ( $framework !== 'datatables' ) { $bodyClass .= ' dt-example-'.$framework; } // Resolve CSS libraries $this->_resolve_xml_libs( $framework, 'css', $xml->css ); // Resolve JS libraries $this->_resolve_xml_libs( $framework, 'js', $xml->js ); if ( isset( $this->_additional_libs['css'] ) ) { $this->_resolve_libs( $framework, 'css', $this->_additional_libs['css'] ); } if ( isset( $this->_additional_libs['js'] ) ) { $this->_resolve_libs( $framework, 'js', $this->_additional_libs['js'] ); } // Build data $tableHtml = $this->build_table( (string)($xml['table-type']) ); //echo $tableHtml; $template = file_get_contents( $this->_template ); if ( ! $template ) { throw new Exception("Template file {$template} not found}", 1); } $software = 'DataTables'; if ( isset( $xml->title['lib'] ) ) { $software = $xml->title['lib']; } $template = str_replace( '{software}', $software, $template ); $template = str_replace( '{title}', (string)$xml->title, $template ); $template = str_replace( '{info}', DT_Markdown( $xml->info ), $template ); $template = str_replace( '{css-libs}', $this->_format_libs('css'), $template ); $template = str_replace( '{js-libs}', $this->_format_libs('js'), $template ); $template = str_replace( '{css-lib-files}', $this->_format_lib_files('css'), $template ); $template = str_replace( '{js-lib-files}', $this->_format_lib_files('js'), $template ); $template = str_replace( '{table}', $tableHtml, $template ); $template = str_replace( '{year}', date('Y'), $template ); $template = str_replace( '{table-class}', $software, $template ); $template = str_replace( '{body-class}', $bodyClass ? $bodyClass : '', $template ); if ( isset( $xml->{'demo-html'} ) ) { $template = str_replace( '{demo-html}', $this->innerXML($xml->{'demo-html'}), $template ); } else { $template = str_replace( '{demo-html}', '', $template ); } if ( isset( $opts['toc'] ) ) { $template = str_replace( '{toc}', $opts['toc'], $template ); } $template = $this->_htmlTidy( $template ); // After the tidy to preserve white space as tidy "cleans" it up $template = str_replace( '{css}', $this->_plain( 'css' ), $template ); $template = str_replace( '{js}', $this->_plain( 'js' ), $template ); $template = str_replace( '{css-esc}', htmlspecialchars( trim($this->_plain( 'css' )) ), $template ); $template = str_replace( '{js-esc}', htmlspecialchars( trim($this->_plain( 'js' )) ), $template ); $template = preg_replace( '/\t {js-libs}

    {software} example {title}

    {info}
    {demo-html} {table}
    • Javascript
    • HTML
    • CSS
    • Ajax
    • Server-side script

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

    {js-esc}

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

    {js-lib-files}

    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:

    {css-esc}

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

    {css-lib-files}

    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.

    DataTablesSrc-1.10.11/build/templates/example_index.html000066400000000000000000000025441265711500300231410ustar00rootroot00000000000000 {css-libs} {js-libs} {software} examples - {title}

    {software} example {title}

    {info}
    DataTablesSrc-1.10.11/build/unit_tests.sh000077500000000000000000000067771265711500300202070ustar00rootroot00000000000000#!/bin/sh ENABLE=$1 echo "" echo " DataTables unit tests" echo "" if [ ! "$ENABLE" = "Enable" -a ! "$ENABLE" = "Disable" -o "ENABLE" = "-h" ]; then echo " Enable or Disable must be given as the first argument." echo " Optionally the second argument can be given as an integer to enable/disable a certain " echo " set of tests or the string 'sanity' to run the sanity check for all data types." echo "" exit 1 fi cd ../media/unit_testing if [ "$ENABLE" = "Enable" ]; then if [ ! -d tests ]; then echo " Building test directory" mkdir tests mkdir tests/1_dom mkdir tests/2_js mkdir tests/3_ajax mkdir tests/4_server-side mkdir tests/5_ajax_objects mkdir tests/6_delayed_rendering fi echo " Enabling:" if [ ! -z $2 ]; then if [ "$2" = "sanity" ]; then echo " Sanity checks" mv tests_onhold/1_dom/_zero_config.js tests/1_dom/ mv tests_onhold/2_js/_zero_config.js tests/2_js/ mv tests_onhold/3_ajax/_zero_config.js tests/3_ajax/ mv tests_onhold/4_server-side/_zero_config.js tests/4_server-side/ mv tests_onhold/5_ajax_objects/_zero_config.js tests/5_ajax_objects/ mv tests_onhold/6_delayed_rendering/_zero_config.js tests/6_delayed_rendering/ elif [ $2 -eq 1 ]; then echo " DOM" mv tests_onhold/1_dom/* tests/1_dom/ elif [ $2 -eq 2 ]; then echo " JS" mv tests_onhold/2_js/* tests/2_js/ elif [ $2 -eq 3 ]; then echo " Ajax" mv tests_onhold/3_ajax/* tests/3_ajax/ elif [ $2 -eq 4 ]; then echo " SErver-side" mv tests_onhold/4_server-side/* tests/4_server-side/ elif [ $2 -eq 5 ]; then echo " Ajax objects" mv tests_onhold/5_ajax_objects/* tests/5_ajax_objects/ elif [ $2 -eq 6 ]; then echo " Delayed rendering" mv tests_onhold/6_delayed_rendering/* tests/6_delayed_rendering/ fi else echo " All tests" mv tests_onhold/1_dom/* tests/1_dom/ mv tests_onhold/2_js/* tests/2_js/ mv tests_onhold/3_ajax/* tests/3_ajax/ mv tests_onhold/4_server-side/* tests/4_server-side/ mv tests_onhold/5_ajax_objects/* tests/5_ajax_objects/ mv tests_onhold/6_delayed_rendering/* tests/6_delayed_rendering/ fi else echo " Disabling:" if [ ! -z $2 ]; then if [ "$2" = "sanity" ]; then echo " Sanity checks" mv tests/1_dom/* tests_onhold/1_dom/ mv tests/2_js/* tests_onhold/2_js/ mv tests/3_ajax/* tests_onhold/3_ajax/ mv tests/4_server-side/* tests_onhold/4_server-side/ mv tests/5_ajax_objects/* tests_onhold/5_ajax_objects/ mv tests/6_delayed_rendering/* tests_onhold/6_delayed_rendering/ elif [ $2 -eq 1 ]; then echo " DOM" mv tests/1_dom/* tests_onhold/1_dom/ elif [ $2 -eq 2 ]; then echo " JS" mv tests/2_js/* tests_onhold/2_js/ elif [ $2 -eq 3 ]; then echo " Ajax" mv tests/3_ajax/* tests_onhold/3_ajax/ elif [ $2 -eq 4 ]; then echo " Server-side" mv tests/4_server-side/* tests_onhold/4_server-side/ elif [ $2 -eq 5 ]; then echo " Ajax objects" mv tests/5_ajax_objects/* tests_onhold/5_ajax_objects/ elif [ $2 -eq 6 ]; then echo " Delayed rendering" mv tests/6_delayed_rendering/* tests_onhold/6_delayed_rendering/ fi else echo " All tests" mv tests/1_dom/* tests_onhold/1_dom/ mv tests/2_js/* tests_onhold/2_js/ mv tests/3_ajax/* tests_onhold/3_ajax/ mv tests/4_server-side/* tests_onhold/4_server-side/ mv tests/5_ajax_objects/* tests_onhold/5_ajax_objects/ mv tests/6_delayed_rendering/* tests_onhold/6_delayed_rendering/ fi fi DataTablesSrc-1.10.11/css/000077500000000000000000000000001265711500300151175ustar00rootroot00000000000000DataTablesSrc-1.10.11/css/dataTables.bootstrap.scss000066400000000000000000000076471265711500300221120ustar00rootroot00000000000000 table.dataTable { clear: both; margin-top: 6px !important; margin-bottom: 6px !important; max-width: none !important; td, th { -webkit-box-sizing: content-box; -moz-box-sizing: content-box; box-sizing: content-box; &.dataTables_empty { text-align: center; } } // Style options for the table. Foundation provides its own, but it is also // useful to have a few more for DataTables &.nowrap { th, td { white-space: nowrap; } } } // DataTables' built in feature elements div.dataTables_wrapper { div.dataTables_length { label { font-weight: normal; text-align: left; white-space: nowrap; } select { width: 75px; display: inline-block; } } div.dataTables_filter { text-align: right; label { font-weight: normal; white-space: nowrap; text-align: left; } input { margin-left: 0.5em; display: inline-block; width: auto; } } div.dataTables_info { padding-top: 8px; white-space: nowrap; } div.dataTables_paginate { margin: 0; white-space: nowrap; text-align: right; ul.pagination { margin: 2px 0; white-space: nowrap; } } div.dataTables_processing { position: absolute; top: 50%; left: 50%; width: 200px; margin-left: -100px; margin-top: -26px; text-align: center; padding: 1em 0; } } // Sorting - using Glyphicons table.dataTable thead { > tr > th, > tr > td { &.sorting_asc, &.sorting_desc, &.sorting { padding-right: 30px; } &:active { outline: none; } } .sorting, .sorting_asc, .sorting_desc, .sorting_asc_disabled, .sorting_desc_disabled { cursor: pointer; position: relative; &:after { position: absolute; bottom: 8px; right: 8px; display: block; font-family: 'Glyphicons Halflings'; opacity: 0.5; } } .sorting:after { opacity: 0.2; content: "\e150"; /* sort */ } .sorting_asc:after { content: "\e155"; /* sort-by-attributes */ } .sorting_desc:after { content: "\e156"; /* sort-by-attributes-alt */ } .sorting_asc_disabled:after, .sorting_desc_disabled:after { color: #eee; } } // Scrolling div.dataTables_scrollHead table.dataTable { margin-bottom: 0 !important; } div.dataTables_scrollBody { table { border-top: none; margin-top: 0 !important; margin-bottom: 0 !important; thead { // Hide sort icons .sorting:after, .sorting_asc:after, .sorting_desc:after { display: none; } } tbody tr:first-child th, tbody tr:first-child td { border-top: none; } } } div.dataTables_scrollFoot table { margin-top: 0 !important; border-top: none; } // Responsive @media screen and (max-width: 767px) { div.dataTables_wrapper { div.dataTables_length, div.dataTables_filter, div.dataTables_info, div.dataTables_paginate { text-align: center; } } } // // Bootstrap provides a range of styling options for table's via class name // that we want to full support. They sometimes require some customisations // // Condensed table.dataTable.table-condensed { > thead > tr > th { padding-right: 20px; } .sorting:after, .sorting_asc:after, .sorting_desc:after { top: 6px; right: 6px; } } // Frustratingly the border-collapse:collapse used by Bootstrap makes the column // width calculations when using scrolling impossible to align columns. We have // to use `border-collapse: separate` table.table-bordered.dataTable { border-collapse: separate !important; th, td { border-left-width: 0; &:last-child, &:last-child { border-right-width: 0; } } tbody th, tbody td { border-bottom-width: 0; } } // Bordered table div.dataTables_scrollHead table.table-bordered { border-bottom-width: 0; } // Responsive tables. We use rows inside the Bootstrap responsive wrapper, // so they need to have their margin and padding removed div.table-responsive > div.dataTables_wrapper > div.row { margin: 0; > div[class^="col-"] { &:first-child { padding-left: 0; } &:last-child { padding-right: 0; } } } DataTablesSrc-1.10.11/css/dataTables.bootstrap4.scss000066400000000000000000000076461265711500300221750ustar00rootroot00000000000000 table.dataTable { clear: both; margin-top: 6px !important; margin-bottom: 6px !important; max-width: none !important; td, th { -webkit-box-sizing: content-box; -moz-box-sizing: content-box; box-sizing: content-box; &.dataTables_empty { text-align: center; } } // Style options for the table. Foundation provides its own, but it is also // useful to have a few more for DataTables &.nowrap { th, td { white-space: nowrap; } } } // DataTables' built in feature elements div.dataTables_wrapper { div.dataTables_length { label { font-weight: normal; text-align: left; white-space: nowrap; } select { width: 75px; display: inline-block; } } div.dataTables_filter { text-align: right; label { font-weight: normal; white-space: nowrap; text-align: left; } input { margin-left: 0.5em; display: inline-block; width: auto; } } div.dataTables_info { padding-top: 0.85em; white-space: nowrap; } div.dataTables_paginate { margin: 0; white-space: nowrap; text-align: right; ul.pagination { margin: 2px 0; white-space: nowrap; } } div.dataTables_processing { position: absolute; top: 50%; left: 50%; width: 200px; margin-left: -100px; margin-top: -26px; text-align: center; padding: 1em 0; } } // Sorting - using :before and :after with UTF8 characters table.dataTable thead { > tr > th, > tr > td { &.sorting_asc, &.sorting_desc, &.sorting { padding-right: 30px; } &:active { outline: none; } } .sorting, .sorting_asc, .sorting_desc, .sorting_asc_disabled, .sorting_desc_disabled { cursor: pointer; position: relative; &:before, &:after { position: absolute; bottom: 0.9em; display: block; opacity: 0.3; } &:before { right: 1em; content: "\2191"; // up arrow - ascending } &:after { right: 0.5em; content: "\2193"; // down arrow - descending } } .sorting_asc:before, .sorting_desc:after { opacity: 1; } .sorting_asc_disabled:before, .sorting_desc_disabled:after { opacity: 0; } } // Scrolling div.dataTables_scrollHead table.dataTable { margin-bottom: 0 !important; } div.dataTables_scrollBody { table { border-top: none; margin-top: 0 !important; margin-bottom: 0 !important; thead { // Hide sort icons .sorting:after, .sorting_asc:after, .sorting_desc:after { display: none; } } tbody tr:first-child th, tbody tr:first-child td { border-top: none; } } } div.dataTables_scrollFoot table { margin-top: 0 !important; border-top: none; } // Responsive @media screen and (max-width: 767px) { div.dataTables_wrapper { div.dataTables_length, div.dataTables_filter, div.dataTables_info, div.dataTables_paginate { text-align: center; } } } // // Bootstrap provides a range of styling options for table's via class name // that we want to full support. They sometimes require some customisations // // Condensed table.dataTable.table-condensed { > thead > tr > th { padding-right: 20px; } .sorting:after, .sorting_asc:after, .sorting_desc:after { top: 6px; right: 6px; } } // Frustratingly the border-collapse:collapse used by Bootstrap makes the column // width calculations when using scrolling impossible to align columns. We have // to use `border-collapse: separate` table.table-bordered.dataTable { border-collapse: separate !important; th, td { border-left-width: 0; &:last-child, &:last-child { border-right-width: 0; } } tbody th, tbody td { border-bottom-width: 0; } } // Bordered table div.dataTables_scrollHead table.table-bordered { border-bottom-width: 0; } // Responsive tables. We use rows inside the Bootstrap responsive wrapper, // so they need to have their margin and padding removed div.table-responsive > div.dataTables_wrapper > div.row { margin: 0; > div[class^="col-"] { &:first-child { padding-left: 0; } &:last-child { padding-right: 0; } } } DataTablesSrc-1.10.11/css/dataTables.foundation.scss000066400000000000000000000044601265711500300222310ustar00rootroot00000000000000 table.dataTable { clear: both; margin: 0.5em 0 !important; max-width: none !important; width: 100%; td, th { -webkit-box-sizing: content-box; -moz-box-sizing: content-box; box-sizing: content-box; &.dataTables_empty { text-align: center; } } // Style options for the table. Foundation provides its own, but it is also // useful to have a few more for DataTables &.nowrap { th, td { white-space: nowrap; } } } // DataTables' built in feature elements div.dataTables_wrapper { position: relative; div.dataTables_length { label { float: left; text-align: left; margin-bottom: 0; } select { width: 75px; margin-bottom: 0; } } div.dataTables_filter { label { float: right; margin-bottom: 0; } input { display: inline-block !important; width: auto !important; margin-bottom: 0; margin-left: 0.5em; } } div.dataTables_info { padding-top: 2px; } div.dataTables_paginate { float: right; margin: 0; } div.dataTables_processing { position: absolute; top: 50%; left: 50%; width: 200px; margin-left: -100px; margin-top: -26px; text-align: center; padding: 1rem 0; } } // Sorting table.dataTable thead { > tr > th, > tr > td { &.sorting_asc, &.sorting_desc, &.sorting { padding-right: 1.5rem; } &:active { outline: none; } } .sorting, .sorting_asc, .sorting_desc { cursor: pointer; } .sorting, .sorting_asc, .sorting_desc, .sorting_asc_disabled, .sorting_desc_disabled { background-repeat: no-repeat; background-position: center right; } .sorting { background-image: url('../images/sort_both.png'); } .sorting_asc { background-image: url('../images/sort_asc.png'); } .sorting_desc { background-image: url('../images/sort_desc.png'); } .sorting_asc_disabled { background-image: url('../images/sort_asc_disabled.png'); } .sorting_desc_disabled { background-image: url('../images/sort_desc_disabled.png'); } } // Scrolling div.dataTables_scrollHead table { margin-bottom: 0 !important; } div.dataTables_scrollBody { table { border-top: none; margin-top: 0 !important; margin-bottom: 0 !important; tbody tr:first-child th, tbody tr:first-child td { border-top: none; } } } div.dataTables_scrollFoot table { margin-top: 0 !important; border-top: none; } DataTablesSrc-1.10.11/css/dataTables.jqueryui.scss000066400000000000000000000026511265711500300217400ustar00rootroot00000000000000 // jQuery UI doesn't provide any table styling options of its own, so we include // the DataTables default styling options and override the few styles that need // to be changed $jqueryui: true; @import 'jquery.dataTables.scss'; table.dataTable { // Sorting thead { th div.DataTables_sort_wrapper { position: relative; span { position: absolute; top: 50%; margin-top: -8px; right: -18px; } } } thead, tfoot { th.ui-state-default { border-left-width: 0; &:first-child { border-left-width: 1px; } } } } /* * Control feature layout */ .dataTables_wrapper { // Paging .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; 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; } } .ui-widget-header { font-weight: normal; } .ui-toolbar { padding: 8px; } &.no-footer { .dataTables_scrollBody { border-bottom: none; } } .dataTables_length, .dataTables_filter, .dataTables_info, .dataTables_processing, .dataTables_paginate { color: inherit; } } DataTablesSrc-1.10.11/css/dataTables.material.scss000066400000000000000000000025451265711500300216630ustar00rootroot00000000000000 // DataTables' built in feature elements div.dataTables_wrapper { div.dataTables_length { } div.dataTables_filter { text-align: right; input { margin-left: 0.5em; } } div.dataTables_info { padding-top: 10px; white-space: nowrap; } div.dataTables_processing { position: absolute; top: 50%; left: 50%; width: 200px; margin-left: -100px; text-align: center; } div.dataTables_paginate { text-align: right; } div.mdl-grid.dt-table { padding-top: 0; padding-bottom: 0; > div.mdl-cell { margin-top: 0; margin-bottom: 0; } } } // Sorting - using :before and :after with UTF8 characters table.dataTable thead { > tr > th, > tr > td { &.sorting_asc, &.sorting_desc, &.sorting { padding-right: 30px; } &:active { outline: none; } } .sorting, .sorting_asc, .sorting_desc, .sorting_asc_disabled, .sorting_desc_disabled { cursor: pointer; position: relative; &:before, &:after { position: absolute; bottom: 11px; display: block; opacity: 0.3; font-size: 1.3em; } &:before { right: 1em; content: "\2191"; // up arrow - ascending } &:after { right: 0.5em; content: "\2193"; // down arrow - descending } } .sorting_asc:before, .sorting_desc:after { opacity: 1; } .sorting_asc_disabled:before, .sorting_desc_disabled:after { opacity: 0; } }DataTablesSrc-1.10.11/css/dataTables.semanticui.scss000066400000000000000000000025761265711500300222320ustar00rootroot00000000000000/* * Styling for DataTables with Semantic UI */ table.dataTable.table { margin: 0; // Sorting icons using Semantic UI's built in icons (Font Awesome) thead th, thead td { position: relative; &.sorting:after, &.sorting_asc:after, &.sorting_desc:after { position: absolute; top: 12px; right: 8px; display: block; font-family: Icons; } &.sorting:after { content: "\f0dc"; color: #ddd; font-size: 0.8em; padding-top: 0.12em; } &.sorting_asc:after { content: "\f0de"; } &.sorting_desc:after { content: "\f0dd"; } } // Easier calculations td, th { -webkit-box-sizing: content-box; -moz-box-sizing: content-box; box-sizing: content-box; &.dataTables_empty { text-align: center; } } // Style options for the table. Semantic UI provides its own, but it is also // useful to have a few more for DataTables &.nowrap { th, td { white-space: nowrap; } } } // DataTables' built in feature elements div.dataTables_wrapper { div.dataTables_length { .ui.selection.dropdown { min-width: 0; } } div.dataTables_filter { input { margin-left: 0.5em; } } div.dataTables_info { padding-top: 13px; white-space: nowrap; } div.dataTables_processing { position: absolute; top: 50%; left: 50%; width: 200px; margin-left: -100px; text-align: center; } div.row.dt-table { padding: 0; } } DataTablesSrc-1.10.11/css/dataTables.uikit.scss000066400000000000000000000057351265711500300212160ustar00rootroot00000000000000 table.dataTable { clear: both; margin-top: 6px !important; margin-bottom: 6px !important; max-width: none !important; td, th { -webkit-box-sizing: content-box; -moz-box-sizing: content-box; box-sizing: content-box; &.dataTables_empty { text-align: center; } } // Style options for the table. Foundation provides its own, but it is also // useful to have a few more for DataTables &.nowrap { th, td { white-space: nowrap; } } } // DataTables' built in feature elements div.dataTables_wrapper { div.row.uk-grid.dt-merge-grid { margin-top: 5px; } div.dataTables_length { label { font-weight: normal; text-align: left; white-space: nowrap; } select { width: 75px; display: inline-block; } } div.dataTables_filter { text-align: right; label { font-weight: normal; white-space: nowrap; text-align: left; } input { margin-left: 0.5em; display: inline-block; width: auto; } } div.dataTables_info { padding-top: 8px; white-space: nowrap; } div.dataTables_paginate { margin: 0; white-space: nowrap; text-align: right; ul.pagination { margin: 2px 0; white-space: nowrap; } } div.dataTables_processing { position: absolute; top: 50%; left: 50%; width: 200px; margin-left: -100px; margin-top: -26px; text-align: center; padding: 1em 0; } } // Sorting icons using UIKit's built in icons (Font Awesome) table.dataTable thead { > tr > th, > tr > td { position: relative; &.sorting_asc, &.sorting_desc, &.sorting { padding-right: 30px; } &.sorting:after, &.sorting_asc:after, &.sorting_desc:after { position: absolute; top: 7px; right: 8px; display: block; font-family: 'FontAwesome'; } &.sorting:after { content: "\f0dc"; color: #ddd; font-size: 0.8em; padding-top: 0.12em; } &.sorting_asc:after { content: "\f0de"; } &.sorting_desc:after { content: "\f0dd"; } } } // Scrolling div.dataTables_scrollHead table.dataTable { margin-bottom: 0 !important; } div.dataTables_scrollBody { table { border-top: none; margin-top: 0 !important; margin-bottom: 0 !important; thead { // Hide sort icons .sorting:after, .sorting_asc:after, .sorting_desc:after { display: none; } } tbody tr:first-child th, tbody tr:first-child td { border-top: none; } } } div.dataTables_scrollFoot table { margin-top: 0 !important; border-top: none; } // Responsive @media screen and (max-width: 767px) { div.dataTables_wrapper { div.dataTables_length, div.dataTables_filter, div.dataTables_info, div.dataTables_paginate { text-align: center; } } } // // UIKit provides a range of styling options for table's via class name // that we want to full support. They sometimes require some customisations // // Condensed table.dataTable.uk-table-condensed { > thead > tr > th { padding-right: 20px; } .sorting:after, .sorting_asc:after, .sorting_desc:after { top: 6px; right: 6px; } } DataTablesSrc-1.10.11/css/jquery.dataTables.scss000066400000000000000000000315451265711500300214060ustar00rootroot00000000000000 // // Colour customisation // // `!default` allows overriding variables that are defined before @import // // Border between the header (and footer) and the table body $table-header-border: 1px solid #111 !default; // Border of rows / cells $table-body-border: 1px solid #ddd !default; // Row background colour (hover, striping etc are all based on this colour and // calculated automatically) $table-row-background: #ffffff !default; // Row colour, when selected (tr.selected) $table-row-selected: #B0BED9 !default; // Text colour of the interaction control elements (info, filter, paging etc) $table-control-color: #333 !default; // Highlight colour of the paging button for the current page $table-paging-button-active: #dcdcdc !default; // Hover colour of paging buttons on mouse over $table-paging-button-hover: #111 !default; // Colour to use when shading $table-shade: black !default; // jQuery UI stylesheet imports this one - there are just two places where we // don't want DataTabels default styles assigned for jQuery UI, so rather than // duplicating the whole file, this is the best option $jqueryui: false !default; // // Functions / mixins // @function tint( $color, $percent ) { @return mix(white, $color, $percent); } @function shade( $color, $percent ) { @return mix($table-shade, $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 { font-weight: bold; } } thead th, thead td { padding: 10px 18px; @if not $jqueryui { // jQuery UI defines its own border border-bottom: $table-header-border; } &:active { outline: none; } } tfoot th, tfoot td { padding: 10px 18px 6px 18px; @if not $jqueryui { // jQuery UI defines its own border border-top: $table-header-border; } } // Sorting @if not $jqueryui { // jQuery UI defines its own sort icons thead { .sorting, .sorting_asc, .sorting_desc { cursor: pointer; *cursor: hand; } .sorting, .sorting_asc, .sorting_desc, .sorting_asc_disabled, .sorting_desc_disabled { background-repeat: no-repeat; background-position: center right; } .sorting { background-image: url('../images/sort_both.png'); } .sorting_asc { background-image: url('../images/sort_asc.png'); } .sorting_desc { background-image: url('../images/sort_desc.png'); } .sorting_asc_disabled { background-image: url('../images/sort_asc_disabled.png'); } .sorting_desc_disabled { background-image: url('../images/sort_desc_disabled.png'); } } } /* * Body styles */ tbody { tr { background-color: $table-row-background; &.selected { background-color: $table-row-selected; } } th, td { padding: 8px 10px; } } // 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 { background-color: shade($table-row-background, 3.6%); // shade by f5 &.selected { background-color: shade($table-row-selected, 3.6%); } } } // Sort column highlighting - add "order-column" 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 { >.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%); } } } } &.no-footer { border-bottom: $table-header-border; } &.nowrap { th, td { white-space: nowrap; } } &.compact { thead th, thead td { padding: 4px 17px 4px 4px; } tfoot th, tfoot td { padding: 4px; } tbody th, tbody td { padding: 4px; } } // Typography th.dt-left, td.dt-left { text-align: left; } th.dt-center, td.dt-center, td.dataTables_empty { text-align: center; } th.dt-right, td.dt-right { text-align: right; } th.dt-justify, td.dt-justify { text-align: justify; } th.dt-nowrap, td.dt-nowrap { white-space: nowrap; } thead, tfoot { th.dt-head-left, td.dt-head-left { text-align: left; } th.dt-head-center, td.dt-head-center{ text-align: center; } th.dt-head-right, td.dt-head-right { text-align: right; } th.dt-head-justify, td.dt-head-justify { text-align: justify; } th.dt-head-nowrap, td.dt-head-nowrap { white-space: nowrap; } } tbody { th.dt-body-left, td.dt-body-left { text-align: left; } th.dt-body-center, td.dt-body-center { text-align: center; } th.dt-body-right, td.dt-body-right { text-align: right; } th.dt-body-justify, td.dt-body-justify { text-align: justify; } th.dt-body-nowrap, td.dt-body-nowrap { white-space: nowrap; } } } // 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.755em; } // Paging .dataTables_paginate { float: right; text-align: right; padding-top: 0.25em; .paginate_button { box-sizing: border-box; display: inline-block; min-width: 1.5em; padding: 0.5em 1em; margin-left: 2px; text-align: center; text-decoration: none !important; cursor: pointer; *cursor: hand; color: $table-control-color !important; border: 1px solid transparent; border-radius: 2px; &.current, &.current:hover { color: $table-control-color !important; border: 1px solid darken( $table-paging-button-active, 27% ); @include gradient( lighten($table-paging-button-active, 28%), $table-paging-button-active ); } &.disabled, &.disabled:hover, &.disabled:active { cursor: default; color: #666 !important; border: 1px solid transparent; background: transparent; box-shadow: none; } &:hover { color: white !important; border: 1px solid $table-paging-button-hover; @include gradient( lighten($table-paging-button-hover, 28%), $table-paging-button-hover ); } &:active { outline: none; @include gradient( lighten($table-paging-button-hover, 10%), darken($table-paging-button-hover, 2%) ); box-shadow: inset 0 0 3px #111; } } .ellipsis { padding: 0 1em; } } // 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))); 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%); 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%); 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%); 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%); 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%); } .dataTables_length, .dataTables_filter, .dataTables_info, .dataTables_processing, .dataTables_paginate { color: $table-control-color; } // Scrolling .dataTables_scroll { clear: both; div.dataTables_scrollBody { *margin-top: -1px; -webkit-overflow-scrolling: touch; th, td { // Setting v-align baseline can cause the headers to be visible vertical-align: middle; } th > div.dataTables_sizing, td > div.dataTables_sizing { // Hide the element used to wrap the content in the header for // the body scrolling table height: 0; overflow: hidden; margin: 0 !important; padding: 0 !important; } } } &.no-footer { .dataTables_scrollBody { border-bottom: $table-header-border; } div.dataTables_scrollHead table, div.dataTables_scrollBody table { border-bottom: none; } } // Self clear the wrapper &:after { visibility: hidden; display: block; content: ""; clear: both; height: 0; } zoom: 1; // Poor old IE } // Collapse the two column display of the control elements when the screen is // small - the info and paging control get collapsed first as they are wider, // and then the length and filter controls @media screen and (max-width: 767px) { .dataTables_wrapper { .dataTables_info, .dataTables_paginate { float: none; text-align: center; } .dataTables_paginate { margin-top: 0.5em; } } } @media screen and (max-width: 640px) { .dataTables_wrapper { .dataTables_length, .dataTables_filter { float: none; text-align: center; } .dataTables_filter { margin-top: 0.5em; } } } DataTablesSrc-1.10.11/descriptors/000077500000000000000000000000001265711500300166705ustar00rootroot00000000000000DataTablesSrc-1.10.11/descriptors/bower.json000066400000000000000000000010661265711500300207040ustar00rootroot00000000000000{ "name": "datatables", "main": [ "media/js/jquery.dataTables.js", "media/css/jquery.dataTables.css", "media/images/sort_asc.png", "media/images/sort_asc_disabled.png", "media/images/sort_both.png", "media/images/sort_desc.png", "media/images/sort_desc_disabled.png" ], "dependencies": { "jquery": ">=1.7.0" }, "license": "MIT", "keywords": [ "jquery", "datatables", "table", "javascript", "library" ], "ignore": [ "/.*", "examples", "media/unit_testing", "composer.json", "dataTables.jquery.json", "package.json" ] } DataTablesSrc-1.10.11/descriptors/composer.json000066400000000000000000000010201265711500300214030ustar00rootroot00000000000000{ "name": "datatables/datatables", "version": "_VERSION_", "description": "DataTables is a plug-in for the jQuery Javascript library. It is a highly flexible tool, based upon the foundations of progressive enhancement, which will add advanced interaction controls to any HTML table.", "homepage": "http://www.datatables.net/", "author": "SpryMedia", "license": [ "MIT" ], "prefer-stable": true, "support": { "forum": "https://datatables.net/forums", "source": "https://github.com/DataTables/DataTablesSrc/" } }DataTablesSrc-1.10.11/descriptors/dataTables.jquery.json000066400000000000000000000014501265711500300231450ustar00rootroot00000000000000{ "name": "DataTables", "version": "_VERSION_", "description": "DataTables enhances HTML tables with the ability to sort, filter and page the data in the table very easily. It provides a comprehensive API and set of configuration options, allowing you to consume data from virtually any data source.", "homepage": "http://datatables.net/", "docs": "http://datatables.net/", "demo": "http://datatables.net/examples", "download": "http://datatables.net/download", "author": { "name": "Allan Jardine", "url": "http://sprymedia.co.uk" }, "licenses": [ { "type": "MIT", "url": "http://datatables.net/license_bsd" } ], "dependencies": { "jquery": ">=1.7" }, "keywords": [ "DataTables", "DataTable", "table", "grid", "filter", "sort", "page", "internationalisable" ] }DataTablesSrc-1.10.11/descriptors/package.json000066400000000000000000000022411265711500300211550ustar00rootroot00000000000000{ "name": "datatables", "version": "_VERSION_", "title": "DataTables", "main": "media/js/jquery.dataTables", "files": [ "media/js/jquery.dataTables.js", "media/js/jquery.dataTables.min.js", "media/css/jquery.dataTables.css", "media/css/jquery.dataTables.min.css", "media/images" ], "license": "MIT", "dependencies": { "jquery": ">=1.7" }, "author": { "name": "Allan Jardine", "url": "http://sprymedia.co.uk" }, "description": "DataTables enhances HTML tables with the ability to sort, filter and page the data in the table very easily. It provides a comprehensive API and set of configuration options, allowing you to consume data from virtually any data source.", "keywords": [ "DataTables", "DataTable", "table", "grid", "filter", "sort", "page", "internationalisable" ], "repository": { "type": "git", "url": "https://github.com/DataTables/DataTables.git" }, "homepage": "http://datatables.net", "jspm": { "dependencies": { "css": "^0.1.5", "jquery": "*" }, "registry": "jspm", "shim": { "media/js/jquery.dataTables": { "deps": ["jquery", "../css/jquery.dataTables.css!"], "exports": "$" } } } } DataTablesSrc-1.10.11/docs/000077500000000000000000000000001265711500300152575ustar00rootroot00000000000000DataTablesSrc-1.10.11/docs/api/000077500000000000000000000000001265711500300160305ustar00rootroot00000000000000DataTablesSrc-1.10.11/docs/api/$().xml000066400000000000000000000040111265711500300170120ustar00rootroot00000000000000 $() Perform a jQuery selection action on the full table. 1.10 $( selector [, modifier ] ) Perform a jQuery selector on the rows and contents of the rows in the tables' `dt-tag tbody` elements. [jQuery selector](http://api.jquery.com/jQuery/#jQuery1) to perform on the nodes inside the table's tbody tag. Option used to specify how the content's of the selected columns should be ordered, and if paging or filtering in the table should be taken into account. This is only useful for operations which involve rows, such as `dt-api column().nodes()` and `dt-api column().data()`. jQuery object with the matched elements in its result set. DataTables makes heavy use of DOM manipulation, removing rows from the document for paging and searching, and removing columns from the document for column visibility, among other actions. jQuery will not find these removed DOM elements when using a standard jQuery statement since it uses the document as the root element and some nodes under DataTables' control have been removed from the document. To provide an easy method to continue using jQuery on these elements, so you can select elements regardless of searching, paging or any other feature of DataTables this method is provided. The selector given to the `dt-api $()` method will be run on all of the `dt-tag tr` elements in the table, and their descendent elements, with the found elements being returned as a jQuery object. DataTablesSrc-1.10.11/docs/api/$.fn.dataTable.isDataTable().xml000066400000000000000000000026001265711500300234520ustar00rootroot00000000000000 $.fn.dataTable.isDataTable() Check is a table node is a DataTable or not 1.10 isDataTable( table ) Check if a `-tag table` node is a DataTable table already or not. The table to check. This can be given as the DOM element, a jQuery selector for the node to check, or a jQuery object containing the node to check. Note that only the first node is checked if the jQuery selector or object match multiple nodes. `true` the given table is a DataTable, `false` otherwise This method provides the ability to check if a `-tag table` node is already a DataTable or not. This can be useful to ensure that you don't re-initialise a table that is already a DataTable. Please note that this is a **static** function and is accessed through the `$.fn.dataTable` object, not an API instance. It can be accessed at any time, even before any DataTables have been created on the page. DataTablesSrc-1.10.11/docs/api/$.fn.dataTable.tables().xml000066400000000000000000000040241265711500300225510ustar00rootroot00000000000000 $.fn.dataTable.tables() Get all DataTables on the page 1.10 tables( [ visible ] ) Get all DataTable tables that have been initialised - optionally you can select to get only currently visible tables and / or retrieve the tables as API instances. As a boolean value this options is used to indicate if you want all tables on the page should be returned (`false`), or visible tables only (`true`). Since 1.10.8 this option can also be given as an object which has the following optional parameters: * `-type boolean` `visible` - Get only visible tables (`true`) or all tables regardless of visibility (`false`). * `-type boolean` `api` - Return a `-type DataTables.Api` instance for the selected tables or an `-type array` Array or DataTables API instance containing all matching DataTables It can be useful to be able to get a list of the existing DataTables on a page, particularly in situations where the table has scrolling enabled and needs to have its column widths adjusted when it is made visible. This method provides that ability. Please note that this is a **static** function and is accessed through the `$.fn.dataTable` object, not an API instance. It can be accessed at any time, even before any DataTables have been created on the page. DataTablesSrc-1.10.11/docs/api/$.fn.dataTable.util.escapeRegex().xml000066400000000000000000000042261265711500300245120ustar00rootroot00000000000000 $.fn.dataTable.util.escapeRegex() Escape special characters in a regular expression string 1.10.4 escapeRegex( str ) Escape special characters in a regular expression string. String to have regex special characters escaped Escaped string When working with regular expressions it can often be useful to escape input so formatted strings with characters that have special meaning in a regular expression will simply perform a character match. There are a number of special characters in Javascript's regular expressions and DataTables requires the ability to escape these strings internally (for user input of search data) - this method exposes that ability externally. This is a utility method that is provided for use by extension and plug-in authors. Its use does not directly effect a DataTable or DataTables configuration. It is used internally by DataTables and is made available in the public API to help promote code reuse for extension authors. ') .appendTo( $(column.footer()).empty() ) .on( 'change', function () { // Escape the expression so we can perform a regex match var val = $.fn.dataTable.util.escapeRegex( $(this).val() ); column .search( val ? '^'+val+'$' : '', true, false ) .draw(); } ); column.data().unique().sort().each( function ( d, j ) { select.append( '' ) } ); } ); ]]> searching columns.searchable search() column().search() DataTablesSrc-1.10.11/docs/api/$.fn.dataTable.util.throttle().xml000066400000000000000000000053021265711500300241200ustar00rootroot00000000000000 $.fn.dataTable.util.throttle() Throttle the calls to a method to reduce call frequency 1.10.3 throttle( fn, [ period ] ) Throttle the calls to a method to reduce call frequency. Function that should have its called throttled Call period when throttled, in milliseconds (mS). Wrapper function that can be called and will automatically throttle calls to the passed in function to the given period. This is a utility method that is provided for use by extension and plug-in authors. Its use does not directly effect a DataTable or DataTables configuration. It is used internally by DataTables and is made available in the public API to help promote code reuse for extension authors. It can often be useful to limit the number of times that a method can be called in a given period of time (throttling). For example, consider searching a table with the `dt-api search()` method. If you are using server-side processing, you might wish to limit the number of requests that are made to the server by time (a fast typist might trigger many Ajax calls per second!). This method can assist in that goal by wrapping the function given in a helper function that you would then call as often as required (in the case of the search example, on every keystroke) and the wrapper function will automatically throttle the number of calls to the target function to the required frequency. Note that any arguments passed to the returned function, when called, will be passed on to the original function. Additional the scope of execution of the original function will match the returned function's scope. Finally, this is not a debounce function - it will execute the function at the defined frequency even while the function is still being called. Considering again the search example from above to illustrate this, the table will be searched at the given frequency, while the user is still typing. It will not wait for the user to stop typing (although a final execution of the function will happen once the user has stopped typing!). DataTablesSrc-1.10.11/docs/api/$.fn.dataTable.versionCheck().xml000066400000000000000000000026651265711500300237330ustar00rootroot00000000000000 $.fn.dataTable.versionCheck() Version number compatibility check function 1.10 versionCheck( version ) Check the compatibility of the running version of DataTables against a version string Version string to check for, in the format "X.Y.Z". Note that the formats "X" and "X.Y" are also acceptable. `true` if this version of DataTables is greater or equal to the required version, or `false` if this version of DataTales is not suitable This method provides the ability for plug-in developers to check a required version number against the running version of DataTables. For example, a plug-in such as [Buttons](/extensions/buttons) might require DataTables 1.10.7 or newer. This method provides the ability to check that. Please note that this is a **static** function and is accessed through the `$.fn.dataTable` object, not an API instance. It can be accessed at any time, even before any DataTables have been created on the page. DataTablesSrc-1.10.11/docs/api/ajax.json().xml000066400000000000000000000034751265711500300205770ustar00rootroot00000000000000 ajax.json() Get the latest JSON data obtained from the last Ajax request DataTables made 1.10 ajax.json() Last Ajax data loaded from the server It can often be useful to be able to read the JSON response from a DataTables request to the server for data to summarise data, or obtain data that was also returned in the response but isn't directly used by the DataTable (this is a good technique to use where otherwise multiple Ajax requests would be needed, to help improve performance). This method is provided to give access to that data. Note that if the API instance references multiple DataTable instances, only the JSON data from the first table in the selection will be returned. Use the `dt-api table()` method to obtain an API instance for a specific DataTable is you are working with multiple tables. Furthermore, if the `dt-init ajax` option is given as a function, this method will return `undefined` rather than the JSON string, since the given function effectively overwrites DataTables own Ajax handler. ajax ajax.json() ajax.params() ajax.url() ajax.url().load() ajax.reload() xhr DataTablesSrc-1.10.11/docs/api/ajax.params().xml000066400000000000000000000030511265711500300210770ustar00rootroot00000000000000 ajax.params() Get the data submitted by DataTables to the server in the last Ajax request 1.10 ajax.params() Data submitted in the last Ajax request. If no Ajax request has been made, `dt-type undefined` is returned. It can sometimes be useful to know what data was used in the last Ajax request submitted to the server. This method provides that ability by simply returning the data object that was used in the last Ajax request DataTables made. The data object stored is the resulting object once the `dt-init ajax.data` option has been fully evaluated, so any custom parameters are also stored. This object is considered to be read-only, as writing values to it will have no impact upon any DataTables operation - it is provided solely for the use of the API. ajax ajax.json() ajax.url() ajax.url().load() ajax.reload() xhr DataTablesSrc-1.10.11/docs/api/ajax.reload().xml000066400000000000000000000042651265711500300210720ustar00rootroot00000000000000 ajax.reload() Reload the table data from the Ajax data source 1.10 ajax.reload( callback, resetPaging ) Function which is executed when the data as been reloaded and the table fully redrawn. The function is given a single parameter - the JSON data returned by the server, and expects no return. Reset (default action or `true`) or hold the current paging position (`false`). A full re-sort and re-filter is performed when this method is called, which is why the pagination reset is the default action. DataTables.Api instance In an environment where the data shown in the table can be updated at the server-side, it is often useful to be able to reload the table, showing the latest data. This method provides exactly that ability, making an Ajax request to the already defined URL (use `dt-api ajax.url()` if you need to alter the URL). ajax ajax.json() ajax.url() ajax.url().load() ajax.reload() xhr DataTablesSrc-1.10.11/docs/api/ajax.url().load().xml000066400000000000000000000032061265711500300214570ustar00rootroot00000000000000 ajax.url().load() Load data from the newly set data source URL 1.10 ajax.url().load( callback, resetPaging ) Function which is executed when the data as been reloaded and the table fully redrawn. The function is given a single parameter - the JSON data returned by the server, and expects no return. Reset (default action or `true`) or hold the current paging position (`false`). A full re-sort and re-filter is performed when this method is called, which is why the pagination reset is the default action. DataTables.Api instance Trigger a load of an Ajax data source when a URl has been set using the `dt-api ajax.url()` method. Note `dt-api ajax.url()` must be used a setter to set the URL, not a getter for this `load()` method to be available in the returned object. ajax ajax.json() ajax.url() ajax.url().load() ajax.reload() xhr DataTablesSrc-1.10.11/docs/api/ajax.url().xml000066400000000000000000000041151265711500300204200ustar00rootroot00000000000000 ajax.url() Get / set the URL that DataTables uses to Ajax fetch data 1.10 ajax.url() URL set as the Ajax data source for the table. Note that if the Api instance refers to multiple tables, only the Ajax data source URL of the first table in the instance is returned. Use `dt-api table()` if you require to select a specific table from a set. ajax.url( url ) URL to set to be the Ajax data source for the table. DataTables.Api instance While the `dt-api ajax.reload()` option makes it very easy to simply reload data from the existing data source, there are times when you want to change the data source URL. This method is design to fit that purpose. It can also be used to retrieve the currently set Ajax data source URL for a table. Note that when setting a URL you will normally want to chain the `dt-api ajax.url().load()` method to immediately load the newly set data source URL - using `dt-api ajax.url()` method alone does not trigger an Ajax request, it mearly sets the Ajax data source URL. ajax ajax.json() ajax.url() ajax.url().load() ajax.reload() xhr DataTablesSrc-1.10.11/docs/api/ajax.xml000066400000000000000000000027731265711500300175060ustar00rootroot00000000000000 ajax Namespace for Ajax methods 1.10 Ajax obtained data in DataTables is often a very convenient way of working with large data sets as it allows decoupling of the data retrieval methods from the display. At initialisation time the Ajax data options are controlled using the `dt-init ajax` option, while after initialisation the API provides a number of methods for obtaining the loaded data, altering the settings and loading new data. This property is a static object of the DataTables API which is used simply to provide a namespace for its child methods, which are used to control the Ajax operations DataTables can provide, and retrieve the data retrieved by Ajax requests. Please refer to the documentation for each of those methods for details on how they operate. ajax ajax.json() ajax.params() ajax.url() ajax.url().load() ajax.reload() xhr DataTablesSrc-1.10.11/docs/api/any().xml000066400000000000000000000033521265711500300174650ustar00rootroot00000000000000 any() Determine if there are any entries in the result set 1.10.7 any() Get a boolean value to indicate if there are any entries in the API instance's result set (i.e. any data, selected rows, etc). `true` if there there is one or more items in the result set, `false` otherwise. It can be useful to known if an API instance contains any data so you can determine what action to take. For example, knowing if the table has any data in it, if a row selector finds any rows or if specific data is available in the table. While with a standard Javascript `-type array` you can simply test for the `length` property being 0, that isn't always true with the DataTables API object as it is multi-table aware. This means that it can contain arrays of information from multiple tables, which may themselves be empty. This method provides a quick method to check if there are any results available in the API instance. It's result could also be determined by using the `dt-api flatten()` method and then checking the resulting length (i.e. `api.flatten().length !== 0`). dt-api count() DataTablesSrc-1.10.11/docs/api/cell().cache().xml000066400000000000000000000043361265711500300210030ustar00rootroot00000000000000 cell().cache() Get the DataTables cached data for the selected cell 1.10 cell().cache( type ) Get cached data of the cache type specified Specify which cache the data should be read from. Can take one of two values: `dt-string search` or `dt-string order` DataTables API instance with the cached data for each selected cell in the result set DataTables caches data for searching and ordering in order for those operations to run as quickly as possible when they are required. Sometimes it can be useful to get the data that DataTables has cached for these operations, access to which is provided by this method. Cached data is not guaranteed to be available at any particular moment. If DataTables hasn't requested the data, it won't have been cached. This is particularly obvious when using the `-string order` option and a sort hasn't been performed on a column. Invalidation of data will also cause the cache to be removed. It should be noted that this method is required as DataTables has the ability to use different data for its different operations (searching, ordering, display etc) - see `dt-init columns.data` and `dt-init columns.render` for further information. `dt-api cell().data()` provides access to the original data. If you aren't using orthogonal data for the different operations of DataTables, then this method is of limited used. Note that this method is primarily aimed at plug-in developers who require access to the internal data that DataTables has stored. cells().cache() cells().data() cells().render() cell().data() cell().render() DataTablesSrc-1.10.11/docs/api/cell().data().xml000066400000000000000000000045201265711500300206440ustar00rootroot00000000000000 cell().data() Get / set data for the selected cell 1.10 cell().data() Get the data for the selected cell Data from the cell cell().data( set ) Set the data for the selected cell Value to assign to the data for the cell DataTables API instance with selected cell as the result set This method is used to work with the data in the cell retrieved by the selector used in the `dt-api cell()` call. It can be used to get the existing data, or set a new value. Note that when used as a setter, this method sets the data to apply to the table, storing it in the data source array or object for the row, but does not update the table's internal caches of the data (i.e. the search and order cache) until the `dt-api draw()` method is called. The draw can be triggered as a chained method of the `dt-api cell().data()` method's returned object - for example `table.cell( 0, 0 ).data( 'Updated' ).draw();`. Moreover, although the internal cache is not updated until the next draw, the change to the cell's content is visible immediately upon calling this method as a setter, as it writes to the cell's content using `innerHTML`. cells().cache() cells().data() cells().render() cell().cache() cell().render() DataTablesSrc-1.10.11/docs/api/cell().index().xml000066400000000000000000000040271265711500300210440ustar00rootroot00000000000000 cell().index() Get index information about the selected cell 1.10 cell().index() Get row, column and visible column index information Object with index information for the selected cell. See below for the object structure. DataTables stores the data for rows and columns in internally indexes which it can utilise for fast operation of ordering, searching etc. It can be useful at times to know what these indexes are, as they can be used for efficient selectors in the `dt-api row()`, `dt-api column()` and other API methods which use selectors. Usefully this method also provides the visible column index as well as the column data index, as columns can be added and removed from the document dynamically. The data structure returned for the cell in the result set, selected by `dt-api cell()` is: ```js { "row": integer, // Row index "column": integer, // Column data index "columnVisible": integer // Column visible index } ``` cells().indexes() row().index() column().index() column.index() DataTablesSrc-1.10.11/docs/api/cell().invalidate().xml000066400000000000000000000056621265711500300220630ustar00rootroot00000000000000 cell().invalidate() Invalidate the data held in DataTables for the selected cells 1.10 cell().invalidate( [ source ] ) Invalidate information in the selected cell Data source to read the new data from. By default, DataTables will automatically read the new data for the row from the same source as it was originally read (i.e. DOM sourced or Javascript sourced) but this parameter can be used to override that and tell DataTables specifically which should be used to read in the new data. This might be useful if you are Ajax loading data but use the DOM to modify the contents of cells. This property can take the values: * `-string auto` - use original data source * `-string data` - use the Javascript data structure * `-string dom` - use the data currently held in the DOM DataTables API instance with selected cell reference in the result set DataTables holds cached information about the contents of each cell in the table to increase performance of table operations such as ordering and searching. If you were to modify the contents of a cell (for DOM data source tables) or the array / object values (for Ajax / JS source tables) DataTables wouldn't know that this has happened. This method can be used to tell DataTables to re-read the information from the data source for the row (be it from the DOM or objects / arrays - whatever the original data source was). This provides an alternative to using `dt-api cell().data()` and `dt-api row().data()` when changing cell values. Typically the `data` methods are preferred over the invalidation methods, as they use less code, but where the invalidation methods really shine is when the data source for the table are external objects which can be updated using that objects own methods. Prior to DataTables 1.10.4 this method actually invalidated the whole row. As of 1.10.4 only the cell in question is invalidated. cells().cache() cells().data() cells().render() cells().invalidate() cell().cache() cell().data() cell().render() row().invalidate() DataTablesSrc-1.10.11/docs/api/cell().node().xml000066400000000000000000000016651265711500300206670ustar00rootroot00000000000000 cell().node() Get the DOM element for the selected cell 1.10 cell().node() Get the DOM element for the selected cell The `dt-tag TD` / `dt-tag TH` cell the selector resolved to This method, used in-combination with the `dt-api cell()` method (and therefore the various selector forms that it allows) will obtain the DOM node for the selected cell, allowing it to be directly manipulated. cells().nodes() DataTablesSrc-1.10.11/docs/api/cell().render().xml000066400000000000000000000042311265711500300212110ustar00rootroot00000000000000 cell().render() Get rendered data for a cell 1.10.3 cell().render( type ) Get rendered data for the selected cell Data type to get. This can be one of: * `-string display` * `-string filter` * `-string sort` * `-string type` Rendered data for the requested type DataTables has the ability to use [orthogonal data](/manual/orthogonal-data) - i.e. different data for the same cell, depending on the operation being performed. A typical example of this is date / time data being used in numeric format (i.e. a timestamp) for sorting, but a complex formatted form for display. The `dt-api cell().data()` method provides access to the underlying raw data, while this method provides access to the rendered data for each type. It is provided to allow plug-in authors access to the orthogonal data available in the table. Note that calling this method will evaluate the renderer for the cell, rather than reading the information from cache (see `dt-api cell().cache()` to read from cache and `dt-api cell().invalidate()` to clear cache). columns.data columns.render cells().data() cell().data() cell().render() cell().invalidate() DataTablesSrc-1.10.11/docs/api/cell().xml000066400000000000000000000044141265711500300176150ustar00rootroot00000000000000 cell() Select a single cell from a table. 1.10 cell( cellSelector [, modifier ] ) Select the cell found by a cell selector Cell selector. Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account. DataTables API instance with selected cells cell( rowSelector, columnSelector [, modifier ] ) Select the cell found from both row and column selectors Row selector, used to specify which row the cell should be taken from. Column selector, used to specify which column the cell should be taken from. Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account. DataTables API instance with selected cell Select an individual cell to work with from a DataTable, with its chained methods providing the ability to get / set the data in the cell, work with it node directly and other actions. Note that this method selects a single cell. If the selectors provided resolve to multiple cells in this method, the result will be truncated to just a single cell - the first one found. If you need to work with multiple cells, the `dt-api cells()` method is available with the same selection options. The method has two forms, reflecting the fact the cells can be selected in multiple different ways as your implementation demands: * Cell selector * Cross product between row and column selectors cells() DataTablesSrc-1.10.11/docs/api/cells().cache().xml000066400000000000000000000052171265711500300211650ustar00rootroot00000000000000 cells().cache() Get the DataTables cached data for the selected cells 1.10 cells().cache( type ) Get cached data of the cache type specified Specify which cache the data should be read from. Can take one of two values: `dt-string search` or `dt-string order` DataTables API instance with the cached data for each selected cell in the result set DataTables caches data for searching and ordering in order for those operations to run as quickly as possible when they are required. Sometimes it can be useful to get the data that DataTables has cached for these operations, for example when creating a `select` list to provide a column based filter. Cached data is not guaranteed to be available at any particular moment. If DataTables hasn't requested the data, it won't have been cached. This is particularly obvious when using the `-string order` option and a sort hasn't been performed on a column. Invalidation of data will also cause the cache to be removed. It should be noted that this method is required as DataTables has the ability to use different data for its different operations (searching, ordering, display etc) - see `dt-init columns.data` and `dt-init columns.render` for further information. `dt-api cells().data()` provides access to the original data. If you aren't using orthogonal data for the different operations of DataTables, then this method is of limited used. Note that this method is primarily aimed at plug-in developers who require access to the internal data that DataTables has stored. ') .appendTo( 'body' ) .on( 'change', function () { table .column( 0 ) .search( $(this).val() ) .draw(); } ); // Get the search data for the first column and add to the select list var data = table .cells( '', 0 ) .cache( 'search' ) .sort() .unique() .each( function ( d ) { select.append( $('') ); } ); ]]> cells().render() cells().invalidate() cell().cache() cell().render() cell().invalidate() DataTablesSrc-1.10.11/docs/api/cells().data().xml000066400000000000000000000020131265711500300210220ustar00rootroot00000000000000 cells().data() Get data for the selected cells 1.10 cells().data() Get the data for the selected cells DataTables API instance with the data for each selected cell in the result set This method is used to obtain the data from the cells retrieved by the selector used in the `dt-api cells()` call. Note that unlike its singular counter part (`dt-api cell().data()`) this method does not have a 'set' form. It can only be used to retrieve data. cell().data() cells().render() DataTablesSrc-1.10.11/docs/api/cells().every().xml000066400000000000000000000065031265711500300212530ustar00rootroot00000000000000 cells().every() Iterate over each selected cell, with the function context set to be the cell in question. 1.10.6 cells().every( fn ) Iterate over each selected cell Function to execute for every cell selected. The function's content is set to be an API instance for the cell in question. As of DataTables 1.10.8 the function is passed the following parameters: 1. Cell's row index 2. Cell's column index 3. Table loop counter 4. Cell loop counter No return value is expected or acted upon. DataTables API instance of the selected cells. A often used operation with the DataTable API is to perform an operation on a collection of cells - a common action is performed on each cell, such as adding event handlers, updating data, etc. This iteration of the cells can be performed a number of ways in DataTables, each with its own advantages: * `dt-api cells().every()` * `dt-api iterator()` * `dt-api each()` This `dt-api cells().every()` method is likely to be the most useful in the majority of cases as it sets the context of the callback function to be the `dt-api cell()` instance for the cell in question (normally a callback in the DataTables API has its context set to be at the top level API hierarchy). In simple terms this means you have the methods such as `dt-api cell().data()` available as `this.data()` in the callback given to this method. Consider the following example using `dt-api each()`, which iterates over the cell indexes that have been selected - we are required to get the `dt-api cell()` object for each cell to be able to work with it directly: ```js table.cells().eq(0).each( function ( index ) { var cell = table.cell( index ); var data = cell.data(); // ... do something with data(), or cell.node(), etc } ); ``` Using `dt-api cells().every()` this can be rewritten as: ```js table.cells().every( function () { var data = this.data(); // ... do something with data(), or this.node(), etc } ); ``` Although a relatively simple optimisation in terms of code presentation, it can make the code much more readable and intuitive. The other advantage is that the table context is automatically handled - in the first example above where `dt-api each()` is used, the `dt-api eq()` method is used to select the information from the first table in the API's context only, introducing complexity if multiple tables are used. In `dt-api cells().every()` the table context is automatically set to the appropriate table for each cell that has been selected. 50 ) { $(this.node()).addClass( 'warning' ); } else { $(this.node()).removeClass( 'warning' ); } } ); ]]> columns().every() each() iterator() rows().every() DataTablesSrc-1.10.11/docs/api/cells().indexes().xml000066400000000000000000000033441265711500300215600ustar00rootroot00000000000000 cells().indexes() Get index information about the selected cells 1.10 cells().indexes() Get row, column and visible column index information DataTables API instance with cell index information in the result set DataTables stores the data for rows and columns in internally indexes which it can utilise for fast operation of ordering, searching etc. It can be useful at times to know what these indexes are, as they can be used for efficient selectors in the `dt-api rows()`, `dt-api columns()` and other API methods which use selectors. Usefully this method also provides the visible column index as well as the column data index, as columns can be added and removed from the document dynamically. The data structure returned for each cell in the result set from the `dt-api cells()` selection method is: ```js { "row": integer, // Row index "column": integer, // Column data index "columnVisible": integer // Column visible index } ``` cell().index() rows().indexes() columns().indexes() column.index() DataTablesSrc-1.10.11/docs/api/cells().invalidate().xml000066400000000000000000000055231265711500300222420ustar00rootroot00000000000000 cells().invalidate() Invalidate the data held in DataTables for the selected cells 1.10 cells().invalidate( [ source ] ) Invalidate information in the selected cells Data source to read the new data from. By default, DataTables will automatically read the new data for the row from the same source as it was originally read (i.e. DOM sourced or Javascript sourced) but this parameter can be used to override that and tell DataTables specifically which should be used to read in the new data. This might be useful if you are Ajax loading data but use the DOM to modify the contents of cells. This property can take the values: * `-string auto` - use original data source * `-string data` - use the Javascript data structure * `-string dom` - use the data currently held in the DOM DataTables API instance with selected cell references in the result set DataTables holds cached information about the contents of each cell in the table to increase performance of table operations such as ordering and searching. If you were to modify the contents of a cell (for DOM data source tables) or the array / object values (for Ajax / JS source tables) DataTables wouldn't know that this has happened. This method can be used to tell DataTables to re-read the information from the data source for the row (be it from the DOM or objects / arrays - whatever the original data source was). This provides an alternative to using `dt-api cell().data()` and `dt-api row().data()` when changing cell values. Typically the `data` methods are preferred over the invalidation methods, as they use less code, but where the invalidation methods really shine is when the data source for the table are external objects which can be updated using that objects own methods. Prior to DataTables 1.10.4 this method actually invalidated the whole row for the selected cells. As of 1.10.4 only the cells in question are invalidated. cells().data() cells().render() cell().data() cell().invalidate() cell().render() rows().invalidate() DataTablesSrc-1.10.11/docs/api/cells().nodes().xml000066400000000000000000000020101265711500300212160ustar00rootroot00000000000000 cells().nodes() Get the DOM elements for the selected cells 1.10 cells().nodes() Get the DOM elements for the selected cells DataTables API instance with the `dt-tag TD` / `dt-tag TH` cell elements in the set This method, used in-combination with the `dt-api cells()` method (and therefore the various selector forms that it allows) will obtain the DOM nodes for the selected cells, allowing them to be directly manipulated - for example adding a class. cell().node() DataTablesSrc-1.10.11/docs/api/cells().render().xml000066400000000000000000000040261265711500300213760ustar00rootroot00000000000000 cells().render() Get rendered data for a collection of cells 1.10.3 cells().render( type ) Get rendered data for the selected cells Data type to get. This can be one of: * `-string display` * `-string filter` * `-string sort` * `-string type` DataTables API instance with the data for each selected cell in the result set DataTables has the ability to use [orthogonal data](/manual/orthogonal-data) - i.e. different data for the same cell, depending on the operation being performed. A typical example of this is date / time data being used in numeric format (i.e. a timestamp) for sorting, but a complex formatted form for display. The `dt-api cells().data()` method provides access to the underlying raw data, while this method provides access to the rendered data for each type. It is provided to allow plug-in authors access to the orthogonal data available in the table. Note that calling this method will evaluate the renderer for the cell, rather than reading the information from cache (see `dt-api cells().cache()` to read from cache and `dt-api cells().invalidate()` to clear cache). columns.data columns.render cells().data() cell().data() cell().render() cell().invalidate() DataTablesSrc-1.10.11/docs/api/cells().xml000066400000000000000000000052361265711500300200030ustar00rootroot00000000000000 cells() Select multiple cells from a table. 1.10 cells( [ modifier ] ) Select all cells Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account. DataTables API instance with selected cells cells( cellSelector [, modifier ] ) Select cells found by a cell selector Cell selector. Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account. DataTables API instance with selected cells cells( rowSelector, columnSelector [, modifier ] ) Select cells found by both row and column selectors Row selector, used to specify which rows the cells should be taken from. Column selector, used to specify which columns the cells should be taken from. Option used to specify how the cells should be ordered, and if paging or filtering in the table should be taken into account. DataTables API instance with selected cells This method provides the ability to select multiple cells to work with in a DataTable, with its chained methods providing the ability to get the data from the cell, the nodes and to invalidate the data, among other actions. While `dt-api cell()` provides access to single cells, this `dt-api cells()` method is used to allow multiple cells to be manipulated or modified at the same time. The method has three forms, reflecting the fact the cells can be selected in multiple different ways as your implementation demands: * All cells (no parameters, or just a `dt-type selector-modifier` option) * Cell selector * Cross product between row and column selectors cell() DataTablesSrc-1.10.11/docs/api/clear().xml000066400000000000000000000033271265711500300177660ustar00rootroot00000000000000 clear() Clear the table of all data. 1.10 clear() Simply remove all rows of data from the table. DataTables API instance This method simply removes all rows from the DataTables, resulting in a data length set of 0. New data might then be added using the `dt-api rows.add()` method. Please be aware that this method will not automatically redraw the table with an empty data set. In order to redraw the table use the `dt-api draw()` method, which can be called simply as a chained method of the `dt-api clear()` method's returned object - for example `table.clear().draw();`. This is useful for performance when you would want to immediately add new rows to the table - you would only call the `dt-api draw()` method once all required rows have been added to help improve performance. This method should not be used when `dt-init serverSide` is enabled. When server-side processing is enabled, the data should be deleted from the data store (i.e. an Ajax request to the server) and then `dt-api draw()` called. Deleting the client-side data will have no effect when server-side processing is enabled since the data would simply be restored on the next draw if the data is not removed from the server. data() row.add() rows.add() DataTablesSrc-1.10.11/docs/api/column().cache().xml000066400000000000000000000060401265711500300213530ustar00rootroot00000000000000 column().cache() Get the DataTables cached data for the selected column. 1.10 column().cache( type ) Obtain the data for the column from the selector Specify which cache the data should be read from. Can take one of two values: `dt-string search` or `dt-string order` DataTables API instance with data for each cell in the selected column in the result set. This is a 1D array with each entry being the data for the cells from the selected column. DataTables caches data for searching and ordering in order for those operations to run as quickly as possible when they are required. Sometimes it can be useful to get the data that DataTables has cached for these operations, for example when creating a `select` list to provide a column based filter. Cached data is not guaranteed to be available at any particular moment. If DataTables hasn't requested the data, it won't have been cached. This is particularly obvious when using the `-string order` option and a sort hasn't been performed on a column. Invalidation of data will also cause the cache to be removed. It should be noted that this method is required as DataTables has the ability to use different data for its different operations (searching, ordering, display etc) - see `dt-init columns.data` and `dt-init columns.render` for further information. `dt-api columns().data()` provides access to the original data. If you aren't using orthogonal data for the different operations of DataTables, then this method is of limited used. Please note that the order of the data in the returned array and which rows the data is obtained from (searched rows, visible rows etc) is controlled by the `dt-type selector-modifier` option of the `dt-api column()` selector used to get the selected column. Additionally, if the selector used in `dt-api column()` matches more than one column, the result set will be truncated to a single column - the first one in the result set. Note that this method is primarily aimed at plug-in developers who require access to the internal data that DataTables has stored. ') .appendTo( table.column( 0 ).footer() ) .on( 'change', function () { table .column( 0 ) .search( $(this).val() ) .draw(); } ); // Get the search data for the first column and add to the select list table .column( 0 ) .cache( 'search' ) .sort() .unique() .each( function ( d ) { select.append( $('') ); } ); ]]> columns().cache() DataTablesSrc-1.10.11/docs/api/column().data().xml000066400000000000000000000026211265711500300212220ustar00rootroot00000000000000 column().data() Get the data for the cells in the selected column. 1.10 column().data() Obtain the data for the column from the selector DataTables API instance with data for each cell in the selected columns in the result set. This is a 1D array with each entry being the data for the cells from the selected column. This method is used to get the data used for the cells in the column matched by the selector from DataTables. Please note that the order of the data in the returned array and which rows the data is obtained from (searched rows, visible rows etc) is controlled by the `dt-type selector-modifier` option of the `dt-api column()` selector used to get the selected column. Additionally, if the selector used in `dt-api column()` matches more than one column, the result set will be truncated to a single column - the first one in the result set. columns().data() DataTablesSrc-1.10.11/docs/api/column().dataSrc().xml000066400000000000000000000033111265711500300216670ustar00rootroot00000000000000 column().dataSrc() Get the data source property for the selected column. 1.10.3 column().dataSrc() Get the data source property for the selected column Data source parameter as configured by `dt-init columns.data` DataTables has the ability to read data from a variety of complex data sources through use of the `dt-init columns.data` option. This method provides the ability to retrieve that setting after initialisation based on a column selector (see `dt-type column-selector`). The value of `dt-init columns.data` that was set during initialisation (including the default of a column index integer) will be returned by this method, including functions (unevaluated). It is important to note that how `dt-init columns.render` is set has no effect on the return value of this method, which is used only for retrieving the value of `dt-init columns.data`. It is not possible at this time to use this method as a setter - the data source for a column cannot be changed after initialisation. columns().data() columns().dataSrc() column().data() DataTablesSrc-1.10.11/docs/api/column().footer().xml000066400000000000000000000036651265711500300216200ustar00rootroot00000000000000 column().footer() Get the footer node for the selected column. 1.10 column().footer() Get the footer `dt-tag th` / `dt-tag td` cell for the selected column. Footer cell node for the selected element or `null` if the matched column does not have a footer cell. This method can be used to obtain (and therefore modify) the footer cell for a column. This may be a `dt-tag th` or `dt-tag td` element depending on the HTML for your table. The cell returned is the cell from the first row in the table `dt-tag tfoot` element relating to the selected column. If you have multiple rows in the footer that you wish to manipulate you must use the `dt-api table().footer()` method to obtain the table footer element and then use standard DOM / jQuery methods to manipulate the node. Furthermore, the cells in the `dt-tag tfoot` may span multiple columns using `colspan` (they can also use `rowspan`, but again, only the cells in the first row will be available using this method). As such, a cell which uses `colspan` may belong to multiple columns. Table footers are optional in DataTables. If the table for the column in the result set does not have a footer tag, `null` will be returned as the result. Note that if the selector used in `dt-api column()` matches more than one column, the result set will be truncated to a single column - the first one in the result set. column().footer() DataTablesSrc-1.10.11/docs/api/column().header().xml000066400000000000000000000026731265711500300215500ustar00rootroot00000000000000 column().header() Get the header node for the selected column. 1.10 column().header() Get the header `dt-tag th` / `dt-tag td` cell for a column. The header cell for the selected column. This method can be used to obtain (and therefore modify) the header cell used for a column. This may be a `dt-tag th` or `dt-tag td` element depending on the HTML for your table. The cell return is the one used by DataTables for adding the ordering click listener. If you have multiple cells in a header (i.e. multiple rows), which one DataTables uses as the primary header cell is defined by the `dt-init orderCellsTop` option. Note that if the selector used in `dt-api column()` matches more than one column, the result set will be truncated to a single column - the first one in the result set. columns().header() DataTablesSrc-1.10.11/docs/api/column().index().xml000066400000000000000000000032001265711500300214120ustar00rootroot00000000000000 column().index() Get the column index of the selected column. 1.10 column().index( [type] ) Get the column index of the selected column. Specify if you want to get the column data index (default) or the visible index (`dt-string visible`). The column index for the selected column. DataTables stores the data for rows and columns in internally indexes which it can utilise for fast operation of ordering, searching etc. It can be useful at times to know what these indexes are, as they can be used for efficient selectors in the `dt-api row()`, `dt-api column()` and other API methods which use selectors. This method is used to retrieve the index of the selected column. By default it will return the column data index (i.e. column visibility is not taken into consideration), but by passing `dt-string visible` as the first parameter to the method, the returned indexes will be the columns' visible index, which does take into account hidden columns (for example if column 0 is hidden, all following columns would have their visible index shifted by 1). columns().indexes() DataTablesSrc-1.10.11/docs/api/column().nodes().xml000066400000000000000000000032311265711500300214170ustar00rootroot00000000000000 column().nodes() Get the cell nodes for the selected column. 1.10 column().nodes() Obtain the `dt-tag th` / `dt-tag td` nodes for the selected column DataTables API instance with each cell's node from the selected columns in the result set. This is a 1D array with each entry being the node for the cells from the selected column. This method is used to get the nodes of for the cells (`dt-tag th` / `dt-tag td` elements) in the column matched by the selector. Please note that the order of the nodes in the returned array and which rows the nodes are obtained from (searched rows, visible rows etc) is controlled by the `dt-type selector-modifier` option of the `dt-api columns()` selector used to get the selected columns. Furthermore, please be aware that using `dt-init deferRender` will cause some nodes to be created only when they are required for display, so they might not be immediately available when this method is called. Additionally, if the selector used in `dt-api column()` matches more than one column, the result set will be truncated to a single column - the first one in the result set. columns().nodes() DataTablesSrc-1.10.11/docs/api/column().order().xml000066400000000000000000000034361265711500300214310ustar00rootroot00000000000000 column().order() Order the table by the selected column. 1.10 column().order( direction ) Order the table, in the direction specified, by the column selected by the `dt-api column()` selector. Direction of sort to apply to the selected column - `dt-string desc` (descending) or `dt-string asc` (ascending). DataTables API instance This method provides a useful alternative to the `dt-api order()` method, allowing you to select the column that you want to be ordered using the flexible `dt-api column()` selector and having it ordered in the direction specified. Note that if the selector used for `dt-api column()` matches more than one column, the result will be truncated to a single column. To perform multi-column ordering, please use `dt-api columns().order()` or `dt-api order()`. Please be aware that this method sets the ordering to apply to the table - it does not actually perform the order. In order to have the order performed, use the `dt-api draw()` method, which can be called simply as a chained method of the `dt-api order()` method's returned object - for example `table.order([0, 'desc']).draw();`. order ordering order() columns().order() DataTablesSrc-1.10.11/docs/api/column().search().xml000066400000000000000000000076251265711500300215670ustar00rootroot00000000000000 column().search() Search for data in the selected column. 1.10 column().search() Get the currently applied column search. Search term that is currently applied to the column. This will be an empty string if no search search term is applied. column().search( input [, regex[ , smart[ , caseInsen ]]] ) Set the search term for the column from the selector. Note this doesn't actually perform the search, but rather queues it up - use `dt-api draw()` to perform the search and display the result. Search string to apply to the selected column. Treat as a regular expression (`true`) or not (default, `false`). Perform smart search (default, `true`) or not (`false`). Note that to perform a "smart" search, DataTables uses regular expressions, so if you pass a regular expression in as the second parameter to this method, you will likely want to disable smart searching so the two different regular expressions don't conflict. Do case-insensitive matching (default, `true`) or not (`false`). DataTables API instance While `dt-api search()` provides the ability to search globally across the table, this method, and its plural counterpart, provide the ability to search for data on a specific column. DataTables does not have any column search controls built-in as there are so many different ways that column specific data could be searched, but this method makes adding custom column search controls super easy. The examples below show how it may be used. Note that this search ability in DataTables is actually technically a filter since it is subtractive. However, we term is a search to avoid naming overlap with the `dt-api filter` helper method. Please be aware that this method sets the search to apply to the table only - it does not actually perform the search. In order to have the search performed and the result shown, use the `dt-api draw()` method, which can be called simply as a chained method of the `dt-api column().search()` method's returned object - for example `table.column( [0, 1] ).search( 'Fred' ).draw();`. This is to provide the ability to queue multiple changes before performing a draw. element $('#column3_search').on( 'keyup', function () { table .columns( 3 ) .search( this.value ) .draw(); } ); ]]> ') .appendTo( this.footer() ) .on( 'change', function () { that .search( $(this).val() ) .draw(); } ); // Get the search data for the first column and add to the select list this .cache( 'search' ) .sort() .unique() .each( function ( d ) { select.append( $('') ); } ); } ); ]]> searching columns.searchable search() columns().search() $.fn.dataTable.util.escapeRegex() DataTablesSrc-1.10.11/docs/api/column().visible().xml000066400000000000000000000043301265711500300217450ustar00rootroot00000000000000 column().visible() Get / set the visibility of a single selected column. 1.10 column().visible() Get the visibility of the selected column. `true` if the column is visible, `false` if it is not. column().visible( show [, redrawCalculations ] ) Set the visibility of the selected column. Specify if the column should be visible (`true`) or not (`false`). Indicate if DataTables should recalculate the column layout (`true` - default) or not (`false`). Typically this would be left as the default value, but it can be useful to disable when using the method in a loop - so the calculations are performed on every call as they can hamper performance. DataTables API instance with selected column in the result set. Showing and hiding columns in a DataTable can be quite handy, particularly when showing tables with a large information density. This method allows the visibility of a single column to be changed on-the-fly, or the visibility state of a column to be read. columns().visible() DataTablesSrc-1.10.11/docs/api/column().xml000066400000000000000000000030161265711500300201700ustar00rootroot00000000000000 column() Select a single column from a table. 1.10 column( columnSelector [, modifier ] ) Select the column found by a the column selector Column selector. Option used to specify how the content's of the selected columns should be ordered, and if paging or filtering in the table should be taken into account. This is only useful for operations which involve rows, such as `dt-api column().nodes()` and `dt-api column().data()`. DataTables API instance with selected column in the result set. Select an individual column to work with from a DataTable, with its chained methods providing the ability to get work with the column, taking actions such as toggling its visibility or obtaining the data from the column. Note that this method selects a single column. If the selector provided resolves to multiple columns, the result will be truncated to just a single columns - the first one found. If you need to work with multiple columns, the `dt-api columns()` method is available with the same selection options. column() DataTablesSrc-1.10.11/docs/api/column.index().xml000066400000000000000000000033301265711500300212750ustar00rootroot00000000000000 column.index() Convert between column index formats 1.10 column.index( type, index ) Convert from the input column index type to that required. The type on conversion that should take place: * `dt-string fromVisible` or `dt-string toData` to convert from a visible index to the columns' data index. * `dt-string fromData` or `dt-string toVisible` to convert from a data index to the columns' visible index. The index to be converted Calculated column index When working with the DOM you will typically be using the visible indexes of columns, since that is the information available in the DOM (when a column is hidden by DataTables, it is removed completely from the DOM, to be re-inserted in future if required to become visible again by `dt-api column().visible()`). However, when working with the raw data of the table, you will typically want to work with the column data index. This method is provided to convert between the two formats. DataTablesSrc-1.10.11/docs/api/columns().cache().xml000066400000000000000000000056201265711500300215410ustar00rootroot00000000000000 columns().cache() Get the DataTables cached data for the selected columns. 1.10 columns().cache( type ) Obtain the data for the columns from the selector Specify which cache the data should be read from. Can take one of two values: `dt-string search` or `dt-string order` DataTables API instance with data for each cell in the selected columns in the result set. This is a 2D array with the top level array entries for each column matched by the `dt-api columns()` selector. DataTables caches data for searching and ordering in order for those operations to run as quickly as possible when they are required. Sometimes it can be useful to get the data that DataTables has cached for these operations, for example when creating a `select` list to provide a column based filter. Cached data is not guaranteed to be available at any particular moment. If DataTables hasn't requested the data, it won't have been cached. This is particularly obvious when using the `-string order` option and a sort hasn't been performed on a column. Invalidation of data will also cause the cache to be removed. It should be noted that this method is required as DataTables has the ability to use different data for its different operations (searching, ordering, display etc) - see `dt-init columns.data` and `dt-init columns.render` for further information. `dt-api columns().data()` provides access to the original data. If you aren't using orthogonal data for the different operations of DataTables, then this method is of limited used. Please note that the order of the data in the returned array and which rows the data is obtained from (searched rows, visible rows etc) is controlled by the `dt-type selector-modifier` option of the `dt-api column()` selector used to get the selected column. Note that this method is primarily aimed at plug-in developers who require access to the internal data that DataTables has stored. ') .appendTo( this.footer() ) .on( 'change', function () { that .search( $(this).val() ) .draw(); } ); // Get the search data for the first column and add to the select list this .cache( 'search' ) .sort() .unique() .each( function ( d ) { select.append( $('') ); } ); } ); ]]> column().cache() DataTablesSrc-1.10.11/docs/api/columns().data().xml000066400000000000000000000033761265711500300214150ustar00rootroot00000000000000 columns().data() Get the data for the cells in the selected columns. 1.10 columns().data() Obtain the data for the columns from the selector DataTables API instance with data for each cell in the selected columns in the result set. This is a 2D array with the top level array entries for each column matched by the `dt-api columns()` selector. This method is used to get the data used for the cells in the columns matched by the selector from DataTables. Please note that the order of the data in the returned array and which rows the data is obtained from (searched rows, visible rows etc) is controlled by the `dt-type selector-modifier` option of the `dt-api columns()` selector used to get the selected columns. ' ) ); ]]> column().data() DataTablesSrc-1.10.11/docs/api/columns().dataSrc().xml000066400000000000000000000033471265711500300220630ustar00rootroot00000000000000 columns().dataSrc() Get the data source property for the selected columns. 1.10.3 columns().dataSrc() Get the data source property for the selected columns API instance with the result set containing the data source parameters for the selected columns as configured by `dt-init columns.data` DataTables has the ability to read data from a variety of complex data sources through use of the `dt-init columns.data` option. This method provides the ability to retrieve that setting for multiple columns after initialisation based on a column selector (see `dt-type column-selector`). The value of `dt-init columns.data` that was set during initialisation (including the default of a column index integer) will be returned by this method, including functions (unevaluated). It is important to note that how `dt-init columns.render` is set has no effect on the return value of this method, which is used only for retrieving the value of `dt-init columns.data`. Generally the singular representation of this method, `dt-api column().dataSrc()`, is likely to be more useful for authors. This method is included for completeness in the API. columns().data() column().data() column().dataSrc() DataTablesSrc-1.10.11/docs/api/columns().every().xml000066400000000000000000000104251265711500300216270ustar00rootroot00000000000000 columns().every() Iterate over each selected column, with the function context set to be the column in question. 1.10.6 columns().every( fn ) Iterate over each selected columns Function to execute for every column selected. The function's content is set to be an API instance for the column in question. As of DataTables 1.10.8 the function is passed the following parameters: 1. Column index 2. Table loop counter 3. Column loop counter No return value is expected or acted upon. DataTables API instance of the selected columns. A typical operation with the DataTable API is to perform an operation on a collection of columns - a common action is performed on each column, adding event handlers, updating data, etc. This iteration of the columns can be performed a number of ways in DataTables, each with its own advantages: * `dt-api columns().every()` * `dt-api iterator()` * `dt-api each()` This `dt-api columns().every()` method is likely to be the most useful in the majority of cases as it sets the context of the callback function to be the `dt-api column()` instance for the column in question (normally a callback in the DataTables API has its context set to be at the top level API hierarchy). In simple terms this means you have the methods such as `dt-api column().data()` available as `this.data()` in the callback given to this method. Consider the following example using `dt-api each()`, which iterates over the column indexes that have been selected - we are required to get the `dt-api column()` object for each column to be able to work with it directly: ```js table.columns().eq(0).each( function ( index ) { var column = table.column( index ); var data = column.data(); // ... do something with data(), or column.nodes(), etc } ); ``` Using `dt-api columns().every()` this can be rewritten as: ```js table.columns().every( function () { var data = this.data(); // ... do something with data(), or this.nodes(), etc } ); ``` Although a relatively simple optimisation in terms of code presentation, it can make the code much more readable and intuitive. The other advantage is that the table context is automatically handled - in the first example above where `dt-api each()` is used, the `dt-api eq()` method is used to select the information from the first table in the API's context only, introducing complexity if multiple tables are used. In `dt-api columns().every()` the table context is automatically set to the appropriate table for each column that has been selected. ') .appendTo( this.footer() ) .on( 'change', function () { that .search( $(this).val() ) .draw(); } ); // Get the search data for the first column and add to the select list this .cache( 'search' ) .sort() .unique() .each( function ( d ) { select.append( $('') ); } ); } ); ]]> cells().every() each() iterator() rows().every() DataTablesSrc-1.10.11/docs/api/columns().footer().xml000066400000000000000000000036001265711500300217700ustar00rootroot00000000000000 columns().footer() Get the footer nodes for the selected columns. 1.10 columns().footer() Get the footer `dt-tag th` / `dt-tag td` cell for the selected columns. DataTables API instance with header cells for the selected columns in the result set. This method can be used to obtain (and therefore modify) the footer cells used for multiple columns. This may be made up of `dt-tag th` and / or `dt-tag td` elements depending on the HTML for your table. The cells returned are the cells from the first row in the table `dt-tag tfoot` element relating to the selected columns. If you have multiple rows in the footer that you wish to manipulate you need to use the `dt-api table().footer()` method to obtain the table footer element and then use standard DOM / jQuery methods to manipulate the node. Furthermore, the cells in the `dt-tag tfoot` may span multiple columns using `colspan` (they can also use `rowspan`, but again, only the cells in the first row will be available using this method). As such, a cell which uses `colspan` may belong to multiple columns. Note that table footers are optional in DataTables. If the columns found from the `dt-api columns()` call do not have footer elements, an empty result set will be returned. column().footer() DataTablesSrc-1.10.11/docs/api/columns().header().xml000066400000000000000000000032041265711500300217220ustar00rootroot00000000000000 columns().header() Get the header node for the selected columns. 1.10 columns().header() Get the header `dt-tag th` / `dt-tag td` cell for the selected columns. DataTables API instance with header cells for the selected columns in the result set. This method can be used to obtain (and therefore modify) the header cells used for multiple columns. This may be made up of `dt-tag th` and / or `dt-tag td` elements depending on the HTML for your table. The cells returned are the ones used by DataTables for adding the ordering click listener - i.e. one cell for each column that was matched by the selector. If you have multiple cells in a header (i.e. multiple rows), which one DataTables uses as the primary header cell is defined by the `dt-init orderCellsTop` option. column().header() DataTablesSrc-1.10.11/docs/api/columns().indexes().xml000066400000000000000000000027571265711500300221450ustar00rootroot00000000000000 columns().indexes() Get the column indexes of the selected columns. 1.10 columns().indexes( [type] ) Get the column indexes of the selected columns. Specify if you want to get the column data index (default) or the visible index (`dt-string visible`). DataTables API instance with selected columns' indexes in the result set. DataTables stores the data for rows and columns in internally indexes which it can utilise for fast operation of ordering, searching etc. It can be useful at times to know what these indexes are, as they can be used for efficient selectors in the `dt-api rows()`, `dt-api columns()` and other API methods which use selectors. This method is used to retrieve the indexes of the selected columns. By default it will return the column data index (i.e. column visibility is not taken into consideration), but by passing `dt-string visible` as the first parameter to the method, the returned indexes will be the columns' visible index, which does take into account hidden columns (for example if column 0 is hidden, all following columns would have their visible index shifted by 1). column().index() DataTablesSrc-1.10.11/docs/api/columns().nodes().xml000066400000000000000000000030741265711500300216070ustar00rootroot00000000000000 columns().nodes() Get the cell nodes for the selected columns. 1.10 columns().nodes() Obtain the `dt-tag th` / `dt-tag td` nodes for the selected columns DataTables API instance with each cell's node from the selected columns in the result set. This is a 2D array with the top level array entries for each column matched by the `dt-api columns()` selector. This method is used to get the nodes of for the cells (`dt-tag th` / `dt-tag td` elements) in the columns matched by the selector. Please note that the order of the nodes in the returned array and which rows the nodes are obtained from (searched rows, visible rows etc) is controlled by the `dt-type selector-modifier` option of the `dt-api columns()` selector used to get the selected columns. Furthermore, please be aware that using `dt-init deferRender` will cause some nodes to be created only when they are required for display, so they might not be immediately available when this method is called. column().nodes() DataTablesSrc-1.10.11/docs/api/columns().order().xml000066400000000000000000000037341265711500300216150ustar00rootroot00000000000000 columns().order() Order the table by the selected columns. 1.10 columns().order( direction ) Order the table, in the direction specified, by the columns selected by the `dt-api columns()` selector. Direction of sort to apply to the selected columns - `dt-string desc` (descending) or `dt-string asc` (ascending). Note this one direction is applied to all columns from the selector. DataTables API instance This method provides a useful alternative to the `dt-api order()` method, allowing you to select the columns that you want to be ordered using the flexible `dt-api columns()` selector and having them ordered in the direction specified. Multi-column ordering is achieved by ensuring that the column selector matches multiple columns (single column ordering is performed if only one column is matched, or by using the `dt-api column().order()` method). The order of the matched columns defines the priority sequence in which the ordering of the table is applied. Please be aware that this method sets the ordering to apply to the table - it does not actually perform the order. In order to have the order performed, use the `dt-api draw()` method, which can be called simply as a chained method of the `dt-api order()` method's returned object - for example `table.order([0, 'desc']).draw();`. order ordering order() column().order() DataTablesSrc-1.10.11/docs/api/columns().search().xml000066400000000000000000000117351265711500300217470ustar00rootroot00000000000000 columns().search() Search for data in the selected columns. 1.10 columns().search() Get the currently applied column search. Api instance with the applied search terms for the selected columns in the result set. columns().search( input [, regex[ , smart[ , caseInsen ]]] ) Set the search term for the columns from the selector. Note this doesn't actually perform the search, but rather queues it up - use `dt-api draw()` to perform the search and display the result. Search string to apply to the selected columns. Treat as a regular expression (`true`) or not (default, `false`). Perform smart search (default, `true`) or not (`false`). Please refer to `dt-api search()` for a full description of smart filtering. Note that to perform a smart search, DataTables uses regular expressions, so if enable regular expressions using the second parameter to this method, you will likely want to disable smart searching as the two regular expressions might otherwise conflict and cause unexpected results. Do case-insensitive matching (default, `true`) or not (`false`). DataTables API instance While `dt-api search()` provides the ability to search globally across the table, this method, and its singular counterpart, provide the ability to search for data on specific columns. DataTables does not have any column search controls built-in as there are so many different ways that column specific data could be searched, but this method makes adding custom column search controls super easy. The examples below show how it may be used. DataTables has a built in search algorithm referred to as "smart" searching and is designed to make searching the table data, easy to use for the end user. The smart search is performed using a regular expression and thus must be considered if you are using a regular expression search (second parameter of this method). For a full description of smart searching in DataTables, please refer to the documentation for `dt-api search()`. Note that this search ability in DataTables is actually technically a filter since it is subtractive. However, we term is a search to avoid naming overlap with the `dt-api filter()` helper method. Please be aware that this method sets the search to apply to the table only - it does not actually perform the search. In order to have the search performed and the result shown, use the `dt-api draw()` method, which can be called simply as a chained method of the `dt-api columns().search()` method's returned object - for example `table.columns( [0, 1] ).search( 'Fred' ).draw();`. This is to provide the ability to queue multiple changes before performing a draw. ' ); } ); // DataTable var table = $('#example').DataTable(); // Apply the filter table.columns().every( function () { var column = this; $( 'input', this.footer() ).on( 'keyup change', function () { column .search( this.value ) .draw(); } ); } ); ]]> ') .appendTo( this.footer() ) .on( 'change', function () { that .search( $(this).val() ) .draw(); } ); // Get the search data for the first column and add to the select list this .cache( 'search' ) .sort() .unique() .each( function ( d ) { select.append( $('') ); } ); } ); ]]> searching columns.searchable search() column().search() $.fn.dataTable.util.escapeRegex() DataTablesSrc-1.10.11/docs/api/columns().visible().xml000066400000000000000000000046241265711500300221360ustar00rootroot00000000000000 columns().visible() Get / set the visibility of the selected columns. 1.10 columns().visible() Get the visibility of the selected columns. API instance with the result set containing a boolean value for each column the selector matched. The boolean values indicate: `true` if the column is visible, `false` if it is not. column().visible( show [, redrawCalculations ] ) Set the visibility of the selected columns. Specify if the columns should be visible (`true`) or not (`false`). Indicate if DataTables should recalculate the column layout (`true` - default) or not (`false`). Typically this would be left as the default value, but it can be useful to disable when using the method in a loop - so the calculations are performed on every call as they can hamper performance. DataTables API instance with selected columns in the result set. Showing and hiding columns in a DataTable can be quite handy, particularly when showing tables with a large information density. This method allows the visibility of columns to be changed on-the-fly, or the visibility state of the columns to be read. column().visible() DataTablesSrc-1.10.11/docs/api/columns().xml000066400000000000000000000044351265711500300203610ustar00rootroot00000000000000 columns() Select multiple columns from a table. 1.10 columns( [ modifier ] ) Select all columns Option used to specify how the content's of the selected columns should be ordered, and if paging or filtering in the table should be taken into account. This is only useful for operations which involve rows, such as `dt-api columns().nodes()` and `dt-api columns().data()`. DataTables API instance with selected columns in the result set. columns( columnSelector [, modifier ] ) Select columns found by a column selector Column selector. Option used to specify how the content's of the selected columns should be ordered, and if paging or filtering in the table should be taken into account. This is only useful for operations which involve rows, such as `dt-api columns().nodes()` and `dt-api columns().data()`. DataTables API instance with selected columns Often you will wish to work with one or more columns in a DataTables - this method provides the ability to select multiple columns from tables, with its chained methods providing the ability to get work with the column, such as getting its data or toggling its visibility. While `dt-api column()` provides access to a single column, this `dt-api columns()` method is used to allow multiple columns to be manipulated or modified at the same time. The method has two forms, reflecting the fact the columns can be selected in multiple different ways as your implementation demands: * All columns (no parameters, or just a `dt-type selector-modifier` option) * Columns selector (and optional `dt-type selector-modifier`) column() DataTablesSrc-1.10.11/docs/api/columns.adjust().xml000066400000000000000000000031251265711500300216450ustar00rootroot00000000000000 columns.adjust() Recalculate the column widths 1.10 columns.adjust() Recalculate the column widths for layout. DataTables API instance. Like HTML tables, DataTables attempts to layout tables in an optimal format based on the data in the cells. As the data changes, it can sometimes be useful to recalculate this layout. Additionally DataTables makes extensive use of the dimensions of DOM elements in the table which scrolling is enabled (to align the columns) so if a table is hidden when initialised the height / width of the table elements will be unavailable. This method is provided to have DataTables recalculate the columns sizes, based on the data in the table and the size applied to the columns (in the DOM, CSS or through the `dt-init columns.width` parameter). Call it when the table becomes visible if hidden when initialised (for example in a tab) or when the data changes significantly. DataTables will automatically call this method on the window `resize` event to keep the columns in sync with the re-flowed layout. columns.width autoWidth DataTablesSrc-1.10.11/docs/api/concat().xml000066400000000000000000000031351265711500300201440ustar00rootroot00000000000000 concat() Combine multiple API instances to create a single new instance. 1.10 concat( a [, b [, ... ] ] ) Concatenate two or more API instances together API instance to concatenate to the initial instance. Additional API instance(s) to concatenate to the initial instance. New API instance with the values from all pass in instances concatenated into its result set. The `dt-api concat()` method will combine the result set of two or more DataTables API instances into a single API instance. This method makes use of the fact that DataTables API objects are "array like", in that they inherent a lot of the abilities and methods of the Javascript `Array` type. In this case, this method is a proxy for the Javascript `Array.prototype.concat` method and is provided as a utility method for the DataTables API. For more information about the original method, please refer to the [Mozilla MDN documentation for `concat`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/concat). DataTablesSrc-1.10.11/docs/api/count().xml000066400000000000000000000030001265711500300200140ustar00rootroot00000000000000 count() Get the number of elements that are contained in an API instance 1.10.8 count() Get the number of entries in an API instance's result set, regardless of multi-table grouping (e.g. any data, selected rows, etc). The number of items in the API instance's result set If can sometimes be useful to know how many items are contained in an API's result set - a function that is provided by this method. It is important to note that the `length` property cannot simply be reliably used itself to determine if the API result set contains any elements or not as the DataTables API is multi-table aware and the result set consists of nested arrays. Therefore we must flatten arrays before being able to use the `length` property. This method does exactly that (i.e. it is a shortcut for `api.flatten().length`). dt-api any() DataTablesSrc-1.10.11/docs/api/data().xml000066400000000000000000000042301265711500300176030ustar00rootroot00000000000000 data() Get the data for the whole table. 1.10 data() Retrieve the data for the whole table, in row index order. DataTables API instance with the data for each row from the table in the result set. This method provides access to the raw data that is used for each row in the tables in the API's context. The result set contains the raw data (be it arrays or objects), which each row defined by an entry in the API's result set. The order of the rows in the row data index (i.e. the order the data was originally read into the table). If you modify the data contained in the returned array, ensure that you use the `dt-api rows().invalidate()`, `dt-api row().invalidate()` or any of the other invalidation methods to cause DataTables to notice the change and re-read the data source. Please note that the `dt-api rows().data()` method can also provide full access to this data, but in a more flexible manner as it allows row ordering, paging and searching modifications in the result set through the `dt-type selector-modifier` options object. For example `rows({'order':'index'}).data()` is exactly the same as `data()` - both are in data index order, while `rows().data()` will return the full data set, but in the current display order (as defined by `dt-api order()`). clear() row.add() rows.add() DataTablesSrc-1.10.11/docs/api/destroy().xml000066400000000000000000000052301265711500300203640ustar00rootroot00000000000000 destroy() Destroy the DataTables in the current context. 1.10 destroy( [ remove ] ) Restore the tables in the current context to its original state in the DOM by removing all of DataTables enhancements, alterations to the DOM structure of the table and event listeners. Completely remove the table from the DOM (`true`) or leave it in the DOM in its original plain un-enhanced HTML state (default, `false`). When set to `true`, as of v1.10.8, DataTables will use the [`jQuery .remove()` method](https://api.jquery.com/remove/) to remove the table from the page - this results in any events that are bound to the table elements being automatically removed by jQuery. If set to `false` custom events are not removed from the table - only the events that DataTables itself attached to the table. DataTables API instance DataTables adds a number of HTML elements, event listeners and other modifications in order to enhance the original HTML table with the features of DataTables. This method can be used to remove those enhancements and return the table to its original un-enhanced state, with the data shown in the table. This function can be useful if you require to destroy and create new tables based on new criteria with different initialisation settings or a different number of columns in the table, as they cannot be change on-the-fly through the API. If you do not require to make changes to the features of the table and simply alter the data contained in the table, then consider using the `dt-api clear()`, `dt-api ajax.url()` and `dt-api rows.add()` methods. Destroying a table is necessary to prevent memory leaks if you do wish to replace one table with another. destroy DataTablesSrc-1.10.11/docs/api/draw().xml000066400000000000000000000061611265711500300176340ustar00rootroot00000000000000 draw() Redraw the table. 1.10 draw( [paging] ) Redraw the DataTables in the current context, optionally updating ordering, searching and paging as required. DataTables 1.10.8 or newer. Previous versions support only the boolean option. ]]> DataTables API instance When you perform an action such as adding or deleting a row, changing the sorting, filtering or paging characteristics of the table you'll want DataTables to update the display to reflect these changes. This function is provided for that purpose. A draw is not performed automatically by most DataTables API actions to allow grouping of actions (for example adding multiple rows is more efficient if you group them. Keep in mind that due to the chaining nature of the DataTables API calling the `dt-api draw()` method is just a case of adding `.draw()` to your other API method calls, as shown in the examples below. Note that calling `dt-api draw()` with any option other than the first parameter being `-string page` will result in a full re-order and re-search of the table being performed. The `-string page` option is provided when you wish the table to be updated but for these actions not to occur (for example a page change does not require a full re-order / re-search). drawCallback DataTablesSrc-1.10.11/docs/api/each().xml000066400000000000000000000041461265711500300176000ustar00rootroot00000000000000 each() Iterate over the contents of the API result set. 1.10 each( fn ) Iterate over the contents of the API result set. Callback function which is called for each item in the API instance result set. The callback is called with three parameters: * The element value * The element index in the result set * The API instance being traversed No return value is expected. Original API instance that was used. For chaining. This method makes use of the fact that DataTables API objects are "array like", in that they inherent a lot of the abilities and methods of the Javascript `Array` type. Note that when working with the plural methods such as `dt-api rows()` and `dt-api columns()` you may wish to use the `dt-api rows().every()`, `dt-api columns().every()` and `dt-api cells().every()` methods to iterate over each row, column or cell with the context set to that table element. This might sound a little complicated, but it can significantly simplify your code! Please refer to the documentation for each of the `every` methods for full details. The `dt-api each()` method is a proxy for the Javascript `Array.prototype.forEach` method and is provided as a utility method for the DataTables API. For more information about the original method, please refer to the [Mozilla MDN documentation for `forEach`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach). In browsers which do not support `forEach` natively, a polyfill is provided to allow this DataTables method to operate as expected. DataTablesSrc-1.10.11/docs/api/eq().xml000066400000000000000000000044621265711500300173060ustar00rootroot00000000000000 eq() Reduce an Api instance to a single context and result set. 1.10 eq( idx ) Reduce an API instance to a single context and result set, based on a given index. This can be useful for simplifying some interactions with the API. Index to select New DataTables API instance with the context and result set containing the table and data for the index specified, or null if no matching index was available. The DataTables API is designed to work with multiple tables (_contexts_) in a single API instance, which can often be useful, but there times when you want to work with just a single table and benefit from the reduced complexity that invites (a scalar rather than vector). The API's selectors methods will all provide their result sets in a 2D array format, with the outer array used to identify each table in the context, while the inner array contains that table's results from the selector. You can readily loop over each table if needed, but if you are using just a single table, this method can be used to reduce the API instance to just the table in question. As an illustrative example, the `dt-api rows()` method will return the 2D array format described above, with the the inner array data containing the row indexes selected. For simple manipulation of a single table we want just a 1D array which contains the selected row indexes, and the API instance's context set to the table in question. This is exactly the ability the `dt-api eq()` method provides. DataTablesSrc-1.10.11/docs/api/filter().xml000066400000000000000000000055641265711500300201720ustar00rootroot00000000000000 filter() Create a new API instance with all elements from the result set which pass a given test. 1.10 filter( fn ) Iterate over the result set of an API instance and test each item, creating a new instance from those items which pass. Callback function which is called for each item in the API instance result set. The callback is called with three parameters: * The element value * The element index in the result set * The API instance being traversed The callback should return `true` if the value is to be included in the new instance's own result set, and false otherwise. New API instance with the values from the result set which passed the test in the callback. The `dt-api filter()` method provides a way of filtering out content in an API instance's result set which does not pass the criteria set by the provided callback method. **This method should not be confused with `dt-api search()` which is used to search for records in the DataTable** - i.e. the filter method does not change the rows that are displayed in the DataTable. When working with the plural methods such as `dt-api rows()` and `dt-api columns()` you may wish to use the `dt-api eq()` utility method to reduce the API instance from a 2D array to a 1D array which can be iterated over using this method. This method makes use of the fact that DataTables API objects are "array like", in that they inherent a lot of the abilities and methods of the Javascript `Array` type. In this case, this method is a proxy for the Javascript `Array.prototype.filter` method and is provided as a utility method for the DataTables API. For more information about the original method, please refer to the [Mozilla MDN documentation for `filter`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter). In browsers which do not support `filter` natively, a polyfill is provided to allow this DataTables method to operate as expected. 20 ? true : false; } ); ]]> 20 ? true : false; } ); ]]> DataTablesSrc-1.10.11/docs/api/flatten().xml000066400000000000000000000022371265711500300203340ustar00rootroot00000000000000 flatten() Flatten a 2D array structured API instance to a 1D array structure. 1.10 flatten() Reduce a 2D array structured API instance to a 1D array structure. New API instance with the 2D array values reduced to a 1D array. This method will reduce a 2D array structure to a simple 1D structure, which can be particularly useful when working with the plural methods such as `dt-api rows()` and `dt-api columns()` which can return 2D structures data (for example in the columns data, each column has its own array of information). This method makes use of the fact that DataTables API objects are "array like", in that they inherent a lot of the abilities and methods of the Javascript `Array` type. DataTablesSrc-1.10.11/docs/api/i18n().xml000066400000000000000000000121161265711500300174530ustar00rootroot00000000000000 i18n() Internationalisation token lookup. 1.10.7 i18n( token, def [, numeric ] ) Look up a language token that was defined in the DataTables' `dt-init language` initialisation object. The language token to lookup from the language object. The token should be given in Javascript dotted object notation (as a _string_) which will be used by DataTables to lookup the resulting value. This value follows the same rules as `dt-init columns.data` as a string. The default value to use if the DataTables initialisation has not specified a value. This can be a string for simple cases, or an object for plurals. In the case of plurals, a parameter named `_` **must** be defined - this is the default. For numbers where you wish to have special strings (for example a singular form in English or a dual in Arabic) the number should be defined as the parameter name. If there is no parameter defined for the number requested, the default will be used. The characters `%d` will be replaced in the string by the value given for the `numeric` parameter passed to this function. If handling numeric output, the number to be presented should be given in this parameter. If not numeric operator is required (for example button label text) this parameter is not required. Resulting internationalised string This method is designed for use by plug-in and extension developers building upon DataTables, where the software will present language strings to end users. It provides the ability to use the `dt-init language` configuration object as a single point of configuration for language strings and then look up values from that object. Defaults should be provided for cases where the developer has not provided their own string. The `dt-api i18n()` method also provides basic support for singular, plural, dual, etc forms that must be taken into account when considering internationalisation. This is done by providing an object that contains the keys of the form to be used, as well as a default. Consider for example the following object: ```js { _: "%d rows selected", 0: "Click a row to select", 1: "1 row selected" } ``` In the case where `0` is passed in as the numeric value (third parameter) the _"Click a row to select"_ string will be used. For `1`, the _"1 row selected"_ string will be used. For all other values the default `_` parameter's value will be used with the `%d` replaced by the numeric value. For languages that use a dual form add a `2` parameter, etc. It should be noted that internationalisation (_i18n_ for short) / localisation (_l10n_ for short) [is hard](http://search.cpan.org/dist/Locale-Maketext/lib/Locale/Maketext/TPJ13.pod#A_Localization_Horror_Story:_It_Could_Happen_To_You). This method provides good support for basic internationalisation in DataTables and its components, but not complete support. Complete support is outside the scope of the DataTables library at this time and is a full project itself! language DataTablesSrc-1.10.11/docs/api/indexOf().xml000066400000000000000000000035661265711500300203010ustar00rootroot00000000000000 indexOf() Find the first instance of a value in the API instance's result set. 1.10 indexOf( value ) Find the first instance of a value in the API instance's result set. Value to find in the instance's result set. The index of the item in the result set, or -1 if not found. It is often very useful to know if a value is in a result set, and further, what its position is in the result set if it is present. This method provides exactly that ability, searching for the value given, starting from index 0 (see `dt-api lastIndexOf()` for starting at the end of the array) and giving its position in the result set. This method makes use of the fact that DataTables API objects are "array like", in that they inherent a lot of the abilities and methods of the Javascript `Array` type. In this case, this method is a proxy for the Javascript `Array.prototype.indexOf` method and is provided as a utility method for the DataTables API. For more information about the original method, please refer to the [Mozilla MDN documentation for `indexOf`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf). In browsers which do not support `indexOf` natively, a polyfill is provided to allow this DataTables method to operate as expected. DataTablesSrc-1.10.11/docs/api/init().xml000066400000000000000000000042311265711500300176360ustar00rootroot00000000000000 init() Get the initialisation options used for the table. 1.10.6 init() Get the initialisation options used for the table. Configuration object This method provides access to the initialisation object that was used to create the DataTable. Its intended use is for plug-in authors who wish to be able to provide custom options for their DataTables plug-in in the standard configuration object. When developing with this method keep in mind that the DataTables options are all all optional. They may or may not exist in this object. It is generally not expected that you would check the values of the built-in options (`dt-init paging` for example), but rather for custom objects. The object returned should not be written to. Any changes made will not be detected by DataTables and could potentially lead to unpredictable results. Therefore the returned object should be considered to be read-only. This method is not multi-table aware - it will return the configuration object used for the first table in the context if there is more than one table - use the `dt-api iterator()` method if you require the configuration objects from all tables in a multi-table context. Finally, due to the way DataTables works internally for backwards compatibility, this object will likely contain both camelCase initialisation options and Hungarian notation versions of the same parameters. It is strongly recommended that for custom parameters you use only the camelCase options as this is how DataTables is documented for v1.10+. DataTablesSrc-1.10.11/docs/api/iterator().xml000066400000000000000000000122051265711500300205240ustar00rootroot00000000000000 iterator() Iterate over a result set of table, row, column or cell indexes 1.10 iterator( [flatten,] type, callback [, returns ] ) Iterate over a result set of table, row, column or cell indexes If `true` the result set of the returned API instance will be a 1D array (i.e. flattened into a single array). If `false` (or not specified) each result will be concatenated to the instance's result set. Note that this is only relevant if you are returning arrays from the callback. Iterator type - see above for the options Callback function that is executed on each iteration. For the parameters passed to the function, please refer to the documentation above. As of 1.10.3 this is executed in the scope of an API instance which has its context set to only the table in question. 1.10.4. Indicate if the callback function will return values or not. If set to `true` a new API instance will be returns with the return values from the callback function in its result set. If not set, or `false` the original instance will be returned for chaining, if no values are returned by the callback method. Original API instance if the callback returns no result (i.e. `undefined`) or a new API instance with the result set being the results from the callback, in order of execution. When working with collections of DataTables indexes (such as those placed into the result set by `dt-api tables()`, `dt-api rows()`, `dt-api columns()` and `dt-api cells()`) you often wish to loop over the indexes an perform some kind of operation on the element that each index points to. While this can easily be accomplished with a `for` loop or two, this method can help to simplify and reduce the code by performing those loops for you. **Important**: Please note that if you are working with `dt-api rows()`, `dt-api columns()` and `dt-api cells()`, as of DataTables 1.10.6 you may wish to use the `dt-api rows().every()`, `dt-api columns().every()` and `dt-api cells().every()` methods to iterate over each row, column or cell with the context set to that table element, as those methods can simply your code beyond what is possible with this `dt-api iterator()` method for the majority of cases. There are a number of loop types available (specified by the `type` parameter), and these loop types also effect the parameters that are passed into the callback function: * `table` - loop over the context's (i.e. the tables) for the instance 1. Table settings object 2. Loop counter * `columns` - loop over each item in the result set 1. Table settings object 2. Result set item 3. Loop counter * `column` - loop over each table and column in the result set 1. Table settings object 2. Column index 3. Table counter (outer) 4. Column counter (inner) * `column-rows` - loop over each table, column and row in the result set applying `dt-type selector-modifier`. 1. Table settings object 2. Column index 3. Table counter (outer) 4. Column counter (inner) 5. Row indexes * `rows` - loop over each item in the result set 1. Table settings object 2. Result set item 3. Loop counter * `row` - loop over each table and row in the result set 1. Table settings object 2. Row index 3. Table counter (outer) 4. Row counter (inner) * `cell` - loop over each table and cell in the result set 1. Table settings object 2. Row index 3. Column index 4. Table counter (outer) 5. Cell counter (inner) The return from the callback effects the return value from this method: * If `returns` parameter is set to `true`, a new API instance will be returned with the results contained in its result set. * Otherwise, or `returns` is `false`: * If the callback returns values a new API instance will be returned * Otherwise the original instance will be returned for chaining. This is slightly complex to ensure backwards compatibility which DataTables versions which did not have a `returns` parameter and attempted to automatically determine if a new API instance was required or not. To simplify, always set `returns` to `true` if your method returns a value. Note as of DataTables 1.10.3 the callback function is executed in the scope of a DataTables API instance that as the context of only the table described by the first parameter passed into the function. This can make accessing API method for that specific table much easier. DataTablesSrc-1.10.11/docs/api/join().xml000066400000000000000000000030031265711500300176260ustar00rootroot00000000000000 join() Join the elements in the result set into a string. 1.10 join( separator ) Join the elements in the API instance's result set into a string. The string that will be used to separate each element of the result set. Contents of the instance's result set joined together as a single string. This method operates in exactly the same way as the Javascript array `join` method, combining the contents of the array (in this case the API instance) into a single string. This method makes use of the fact that DataTables API objects are "array like", in that they inherent a lot of the abilities and methods of the Javascript `Array` type. In this case, this method is a proxy for the Javascript `Array.prototype.join` method and is provided as a utility method for the DataTables API. For more information about the original method, please refer to the [Mozilla MDN documentation for concat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/join). DataTablesSrc-1.10.11/docs/api/lastIndexOf().xml000066400000000000000000000037601265711500300211210ustar00rootroot00000000000000 lastIndexOf() Find the last instance of a value in the API instance's result set. 1.10 LastIndexOf( value ) Find the last instance of a value in the API instance's result set. Value to find in the instance's result set. The index of the item in the result set, or -1 if not found. It is often very useful to know if a value is in a result set, and further, what its position is in the result set if it is present. This method provides exactly that ability, searching for the value given, starting from the last item in the instance's result set and working back thought the result set (see `dt-api indexOf()` to search for the first instance of a value) and giving its position in the result set. This method makes use of the fact that DataTables API objects are "array like", in that they inherent a lot of the abilities and methods of the Javascript `Array` type. In this case, this method is a proxy for the Javascript `Array.prototype.lastIndexOf` method and is provided as a utility method for the DataTables API. For more information about the original method, please refer to the [Mozilla MDN documentation for `lastIndexOf`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/lastIndexOf). In browsers which do not support `lastIndexOf` natively, a polyfill is provided to allow this DataTables method to operate as expected. DataTablesSrc-1.10.11/docs/api/length.xml000066400000000000000000000020121265711500300200260ustar00rootroot00000000000000 length Number of elements in an API instance's result set. 1.10 This option defines the number of elements that are stored in an API instance's result set. This property makes use of the fact that DataTables API objects are "array like", in that they inherent a lot of the abilities and methods of the Javascript `Array` type. In this case, this property is basically the same as the `Array.length` property. For more information about the original property, please refer to the [Mozilla MDN documentation for `length`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/length). DataTablesSrc-1.10.11/docs/api/map().xml000066400000000000000000000055461265711500300174620ustar00rootroot00000000000000 map() Create a new API instance with the result set defined by the values returned from the callback function. 1.10 map( fn ) Iterate over the result set of an API instance, creating a new API instance from the values returned by the callback. Callback function which is called for each item in the API instance result set. The callback is called with three parameters: * The element value * The element index in the result set * The API instance being traversed The value returned by the callback will be added to the new API instance's result set, or `dt-type undefined` if no value is returned. New API instance with the values in the result set as those returned by the callback. The `dt-api map()` method is useful for traversing a result set and creating a new instance, whose result set is defined by the values returned. As such any logic condition can be applied to the values of the original result set, transforming the data as required. This method makes use of the fact that DataTables API objects are "array like", in that they inherent a lot of the abilities and methods of the Javascript `Array` type. **Important compatibility note**: This method is implemented in the same way as the ECMA-262 5th edition `Array.prototype.map` method is and is not identical to [jQuery's `$.map` method](http://api.jquery.com/jquery.map/). The key difference is in how the returned value is handled. The ECMAScript standard requires that the resulting array (DataTables API instance in this case) is of identical length as the input array, while that is not true in `$.map`. When using jQuery's `$.map` method `null` or `undefined` can be returned to remove an item from the resulting array. In ECMAScript, and this DataTables method, those values are used in the new instance. If you wish to remove items from the result set, use the `dt-api filter()` method. This method is a proxy for the Javascript `Array.prototype.map` method and is provided as a utility method for the DataTables API. For more information about the original method, please refer to the [Mozilla MDN documentation for `map`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map). In browsers which do not support `map` natively, a polyfill is provided to allow this DataTables method to operate as expected. DataTablesSrc-1.10.11/docs/api/off().xml000066400000000000000000000041061265711500300174460ustar00rootroot00000000000000 off() Table events removal. 1.10 off( event [, callback] ) Remove event listeners that have previously been added with `dt-api on()`. Event name to remove. Multiple events can be removed for using a space separator or namespacing, just as with `jQuery().off()`. Specific callback function to remove if you want to unbind a single event listener. If not given, all events which match the event name / namespace given in the first parameter will be removed. DataTables API instance DataTables can trigger a number of events which can be useful for taking action when DataTables performs those events. For example, it is often useful to know when an Ajax event occurs (`dt-event xhr`), so you can add additional data to the JSON payload. DataTables provides three methods for working with DataTables events, matching the core jQuery event methods: * `dt-api on()` - Listen for events * `dt-api off()` - Stop listening for events * `dt-api one()` - Listen for a single event. This `dt-api off()` method is used to remove a listener that has already been attached to a DataTables. Simply pass in the event you wish to remove the listener, and optionally the specific function if you want to remove only a single event listener. on() one() DataTablesSrc-1.10.11/docs/api/on().xml000066400000000000000000000035541265711500300173160ustar00rootroot00000000000000 on() Table events listener. 1.10 on( event, callback ) Listen for events from tables and fire a callback when they occur Event to listen for. Multiple events can be listened for using a space separator and events can be namespaced, just like with `jQuery().on()`. Event callback handler. For the argument list passed in, please refer to the documentation for the event that you are using. DataTables API instance DataTables can trigger a number of events which can be useful for taking action when DataTables performs those events. For example, it is often useful to know when an Ajax event occurs (`dt-event xhr`), so you can add additional data to the JSON payload. DataTables provides three methods for working with DataTables events, matching the core jQuery event methods: * `dt-api on()` - Listen for events * `dt-api off()` - Stop listening for events * `dt-api one()` - Listen for a single event. This `dt-api on()` method is used to start listening for DataTables events. Simply pass in the event you wish to listen for an provide a callback function which will be activated when the event is triggered by DataTables. off() one() DataTablesSrc-1.10.11/docs/api/one().xml000066400000000000000000000040761265711500300174630ustar00rootroot00000000000000 one() Listen for a table event once and then remove the listener. 1.10 one( event, callback ) Add an event listener, for which the callback will be fired once only and then the event listener removed. Event to listen for. Multiple events can be listened for using a space separator and events can be namespaced, just like with `jQuery().on()`. Event callback handler. For the argument list passed in, please refer to the documentation for the event that you are using. DataTables API instance DataTables can trigger a number of events which can be useful for taking action when DataTables performs those events. For example, it is often useful to know when an Ajax event occurs (`dt-event xhr`), so you can add additional data to the JSON payload. DataTables provides three methods for working with DataTables events, matching the core jQuery event methods: * `dt-api on()` - Listen for events * `dt-api off()` - Stop listening for events * `dt-api one()` - Listen for a single event. This `dt-api on()` method is used to listen for DataTables an event from DataTables and then immediately remove that event once it has fired for the first time. Simply pass in the event you wish to listen for an provide a callback function which will be activated, and then removed, when the event is triggered by DataTables. on() off() DataTablesSrc-1.10.11/docs/api/order().xml000066400000000000000000000110241265711500300200040ustar00rootroot00000000000000 order() Get / set the ordering applied to the table. 1.10 order() Get the current ordering of the table. If there is more than one table in the API's context, the ordering of the first table will be returned. Use `dt-api table()` if you require the ordering of a different table in the API's context. Array of arrays containing information about the currently applied sort. This 2D array is the same format as the array used for setting the order to apply to the table (see below). order( order [, ...] ) Set the ordering to apply to the table using 1D ordering arrays. Note this doesn't actually perform the order, but rather queues it up - use `dt-api draw()` to perform the ordering. An array in the format `[ columnIndex, "asc|desc" ]` (e.g. `[ 1, "desc" ]` to order by the second column descending). Additional arrays in the same format as the first parameter, allowing multi-column sorting. As many or as few additional arrays can be added as additional parameters, as your requirements demand. DataTables API instance order( order ) Set the ordering to apply to the table using a 2D ordering array. Note this doesn't actually perform the order, but rather queues it up - use `dt-api draw()` to perform the ordering. An array in the same format as the 1D array format of this method, above, but with multiple entries in the top level array, allowing multi-column sorting to be defined. DataTables API instance This method provides information and control over the ordering that has been applied to the DataTables in the API's context. Ordering information is stored by DataTables in a 2D array format: ```js [ [ colIdx_1, orderingDirection_1 ], [ colIdx_2, orderingDirection_2 ], ..., [ colIdx_n, orderingDirection_n ] ] ``` where `colIdx_x` is the column data index of the column whose data is used to perform the ordering, and `orderingDirection_n` is the direction of the ordering (`dt-string desc` (descending) or `dt-string asc` (ascending)) - note that these _must_ be lower-case. The column index is zero based - i.e. the first column in the table is index `0`, the second index `1` etc. Using this format, DataTables can achieve single column ordering (i.e. just use one entry in the top level array), or multi-column ordering to the *n*th column (multiple entries in the array). For convenience, this method allows multi-column ordering to be performed by passing in either multiple 1D ordering arrays or a 2D ordering array. When retrieving the ordering information from the table, a 2D ordering array is always returned. Please be aware that this method sets the ordering to apply to the table - it does not actually perform the order. In order to have the order performed, use the `dt-api draw()` method, which can be called simply as a chained method of the `dt-api order()` method's returned object - for example `table.order([0, 'desc']).draw();`. order ordering DataTablesSrc-1.10.11/docs/api/order.fixed().xml000066400000000000000000000054731265711500300211150ustar00rootroot00000000000000 order.fixed() Get / set the fixed ordering applied to the table. 1.10.10 order.fixed() Get the fixed ordering that is applied to the table. If there is more than one table in the API's context, the ordering of the first table will be returned only (use `dt-api table()` if you require the ordering of a different table in the API's context). The returned object may have two properties: * `pre` - Ordering to be applied _before_ the user's own ordering * `post` - Ordering to be applied _after_ the user's own ordering Each property may not be defined, in which case there is no ordering applied from it. order.fixed( order ) Set the table's fixed ordering. Note this doesn't actually perform the order, but rather queues it up - use `dt-api draw()` to perform the ordering. An object which may have neither, one or both of the following properties: * `pre` - Ordering to be applied _before_ the user's own ordering * `post` - Ordering to be applied _after_ the user's own ordering DataTables API instance This method provides the ability to control the fixed ordering that is applied to a DataTable. The "fixed" ordering is a column order that will be applied to a table's ordering before and / or after the user's ordering is applied. Consider for example a table which you wish to always order by column 0, this method (or `dt-init orderFixed`) could be used to apply that fixed order, while the end user would then be able to add their own ordering to the table thanks to DataTables' multi-column ordering. The fixed ordering can be applied before (`pre`) or after (`post`) the user's own ordering criteria using the two different properties that can be given in the value for this method, when used as a setter. The values that are used to describe the ordering conditions for the table are given as two element arrays: * Column index to order upon * Direction so order to apply (`-string asc` for ascending order or `-string desc` for descending order). It is also possible to give a set of nested arrays (i.e. arrays in arrays) to allow multi-column ordering to be assigned. ordering order order() DataTablesSrc-1.10.11/docs/api/order.listener().xml000066400000000000000000000044441265711500300216400ustar00rootroot00000000000000 order.listener() Add an ordering listener to an element, for a given column. 1.10 order.listener( node, column, callback ) Attach an ordering listener to a specified element Selector / node to pick the elements on the page to which the ordering listener should be attached. This can be a DOM node, a jQuery collection of nodes or a jQuery selector string. Column data index of the column that that a click on this node will order the table upon Callback function that is executed whenever the ordering performed by the listener is completed, when the listener is activated. No parameters are passed in and no return is expected. DataTables API instance with the current order in the result set This method provides the ability to attach ordering listeners to any DOM element on the page. This is the same method as DataTables uses internally for the ordering listeners which are attached to the header cells for each column, and as such provides the same functionality (i.e. click to order, shift click to multi-column order etc). Although not a common method to be used, it can be useful for allowing sorting to be triggered externally from the table (equally `dt-api order()` and its columns counterparts could also be used). Note that unlike `dt-api order()` and `dt-api columns().order()` when the ordering listener attached by this function is activated, it will cause the table to redraw automatically - i.e. there is no need to call `dt-api draw()`. order ordering order() column().order() columns().order() DataTablesSrc-1.10.11/docs/api/page().xml000066400000000000000000000051321265711500300176100ustar00rootroot00000000000000 page() Get / set the current page of the table. 1.10 page() Get the current page of the table. Note that if multiple tables are available in the API's context, the current page index of the first table in the context will be used. Use `dt-api table()` if you are working with multiple tables in a single API context. Currently displayed page number page( set ) Set the page to be displayed by the table This parameter can take two forms: * integer - The page index to jump to (0 is the first page!) * string - An action to take: * `first` - Jump to first page. * `next` - Jump to the next page * `previous` - Jump to previous page * `last` - Jump to the last page. DataTables API instance Paging is a core feature of DataTables, and this method provides external control over the page which the table is displaying. This can be useful if you want to provide custom paging controls for your table, external to the built-in paging control options or the paging plug-in options. Note that if you attempt to show a page which does not exist using the set format of this method, DataTables will not throw an error, but rather reset the paging to the first page. Please be aware that this method sets the page to be shown - it does not actually perform the re-display of the table. In order to have the newly set page shown use the `dt-api draw()` method, which can be called simply as a chained method of the `dt-api page()` method's returned object - for example `table.page( 0 ).draw( false );`. Additionally note that you should pass `false` or `-string page` as the first parameter to `dt-api draw()` to have it do a standing redraw. Without this parameter, `dt-api draw()` will do a full draw resulting in the paging being reset back to the first page! paging page.len() DataTablesSrc-1.10.11/docs/api/page.info().xml000066400000000000000000000047761265711500300205570ustar00rootroot00000000000000 page.info() Get paging information about the table 1.10 page.info() Get information about the table's paging state. Note that if multiple tables are available in the API's context, the page length of the first table in the context will be used. Use `dt-api table()` if you are working with multiple tables in a single API context. Object (described below) with information about the table's paging state. The paging state of the table can often be useful to understand what data is being displayed in a table at any given time - indeed it can even be useful when `dt-init paging` is disabled to get information about the number of records in the table. This method provides information about the table's paging state, and information about the number of records in the table (both total and in the search result set). The returned object has the following properties: * `page` - Current page index (zero based - i.e. the first page is `0`) * `pages` - Total number of pages * `start` - Display index for the first record shown on the current page * `end` - Display index for the last record shown on the current page * `length` - Display length (number of records). Note that generally `start + length = end`, but this is not always true, for example if there are only 2 records to show on the final page, with a length of 10. * `recordsTotal` - Full data set length * `recordsDisplay` - Data set length once the current search criteria has been applied. * `serverSide` - A boolean value that indicates if the table is operating in server-side processing mode or not (`dt-init serverSide`). This can be useful when working with paging and the API as index results can be offset by the display start point. Example returned object: ```js { "page": 1, "pages": 6, "start": 10, "end": 20, "length": 10, "recordsTotal": 57, "recordsDisplay": 57, "serverSide": false } ``` paging page.len() DataTablesSrc-1.10.11/docs/api/page.len().xml000066400000000000000000000041711265711500300203670ustar00rootroot00000000000000 page.len() Get / set the table's page length. 1.10 page.len() Get the page length of the table. Note that if multiple tables are available in the API's context, the page length of the first table in the context will be used. Use `dt-api table()` if you are working with multiple tables in a single API context. Current page length. Note that `-1` indicates that all records are shown. page.len( set ) Set the page length to be used for the display Page length to set. use `-1` to show all records. DataTables API instance This method is used quite simply to get and set the length of the paging used by DataTables for display. Please note that this is only relevant when `dt-init paging` is enabled in the table. The special number `-1` can be used as a set parameter, and returned by the get format of this function to indicate that all rows in the DataTable will be displayed. Please be aware that this method sets the page to be shown - it does not actually perform the re-display of the table. In order to have the newly set page shown use the `dt-api draw()` method, which can be called simply as a chained method of the `dt-api page()` method's returned object - for example `table.page( 0 ).draw();`. paging pageLength lengthChange page.info() DataTablesSrc-1.10.11/docs/api/pluck().xml000066400000000000000000000044601265711500300200150ustar00rootroot00000000000000 pluck() Create a new API instance with the value of a property from the objects in the current result set. 1.10 pluck( property ) Iterate over the result set of an API instance, creating a new API instance from the values retrieved from the original elements. Object property name to use from the element in the original result set for the new result set. This will typically be a string with the target property name, but can also be an array index if working with arrays. New API instance with the values in the result retrieved from the source object properties defined by the property being plucked. When working with objects you may often find that you want an array containing just one property of the source object. This typically involves writing a trivial loop to create that array, although here, that loop is performed in this method, reducing the amount of code required to a trivial function call to get the data required. This method makes use of the fact that DataTables API objects are "array like", in that they inherent a lot of the abilities and methods of the Javascript `Array` type. DataTablesSrc-1.10.11/docs/api/pop().xml000066400000000000000000000026741265711500300175020ustar00rootroot00000000000000 pop() Remove the last item from an API instance's result set. 1.10 pop() Remove the last item from an API instance's result set. Item removed form the result set (was previously the last item in the result set). Just as with Javascript arrays', since the DataTables API object is "array like", items can be removed from a result set using this method. *Popping* a result, pops it off the end. The API instance's result set is reduced in length by 1 and the item that was removed is returned from the function call. `dt-api shift()` can be used to perform the same action, but at the start of the array, if required. This method is a proxy for the Javascript `Array.prototype.pop` method and is provided as a utility method for the DataTables API. For more information about the original method, please refer to the [Mozilla MDN documentation for `pop`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/pop). DataTablesSrc-1.10.11/docs/api/push().xml000066400000000000000000000031271265711500300176550ustar00rootroot00000000000000 push() Add one or more items to the end of an API instance's result set. 1.10 push( value_1 [, value_2 [, ...] ] ) Add one or more items to the end of an API instance's result set. Item to add to the API instance's result set. Additional item(s) to add to the API instance's result set. Use as many parameters as you require to add additional items. The length of the modified API instance Just as with Javascript arrays', since the DataTables API object is "array like", items can be added to a result set using this method. *Pushing* an item onto an API instance adds it to the end of the result set. Items can be added at the start of the result set using `dt-api unshift()` if required. This method is a proxy for the Javascript `Array.prototype.push` method and is provided as a utility method for the DataTables API. For more information about the original method, please refer to the [Mozilla MDN documentation for `push`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/push). DataTablesSrc-1.10.11/docs/api/reduce().xml000066400000000000000000000051511265711500300201440ustar00rootroot00000000000000 reduce() Apply a callback function against and accumulator and each element in the Api's result set (left-to-right). 1.10 reduce( fn [, initialValue ] ) Apply a callback function against and accumulator and each element in the Api's result set. Callback function which is called for each item in the API instance result set. The callback is called with four parameters: * Current accumulator value, or `initialValue` if supplied in the first callback * Current element value * The element index in the result set * The API instance being traversed The callback should return the value to be used as the accumulator for the next loop (first parameter in the callback). Value to use as the first argument of the first call to the `fn` callback. Result from the final call to the `fn` callback function. This method can be used to accumulate data from a result set into a single value. A good example is summing the values from a column of data. A more complete definition of the Array reduce method, which this method is based upon, can be found on the [Mozilla MDN documentation for `reduce`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce). Note that the traversal of the elements in the result set in this method is left-to-right (i.e. 0 to `length`). `dt-api reduceRight()` is available for transversal in the opposite direction. This method makes use of the fact that DataTables API objects are "array like", in that they inherent a lot of the abilities and methods of the Javascript `Array` type. In this case, this method is a proxy for the Javascript `Array.prototype.reduce` method and is provided as a utility method for the DataTables API. For more information about the original method, please refer to the [Mozilla MDN documentation for `reduce`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce). In browsers which do not support `reduce` natively, a polyfill is provided to allow this DataTables method to operate as expected. DataTablesSrc-1.10.11/docs/api/reduceRight().xml000066400000000000000000000052261265711500300211450ustar00rootroot00000000000000 reduceRight() Apply a callback function against and accumulator and each element in the Api's result set (right-to-left). 1.10 reduceRight( fn [, initialValue ] ) Apply a callback function against and accumulator and each element in the Api's result set. Callback function which is called for each item in the API instance result set. The callback is called with four parameters: * Current accumulator value, or `initialValue` if supplied in the first callback * Current element value * The element index in the result set * The API instance being traversed The callback should return the value to be used as the accumulator for the next loop (first parameter in the callback). Value to use as the first argument of the first call to the `fn` callback. Result from the final call to the `fn` callback function. This method can be used to accumulate data from a result set into a single value. A good example is summing the values from a column of data. A more complete definition of the Array reduceRight method, which this method is based upon, can be found on the [Mozilla MDN documentation for `reduceRight`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduceRight). Note that the traversal of the elements in the result set in this method is right-to-left (i.e. `length` to 0). `dt-api reduce()` is available for transversal in the opposite direction. This method makes use of the fact that DataTables API objects are "array like", in that they inherent a lot of the abilities and methods of the Javascript `Array` type. In this case, this method is a proxy for the Javascript `Array.prototype.reduceRight` method and is provided as a utility method for the DataTables API. For more information about the original method, please refer to the [Mozilla MDN documentation for `reduceRight`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduceRight). In browsers which do not support `reduceRight` natively, a polyfill is provided to allow this DataTables method to operate as expected. DataTablesSrc-1.10.11/docs/api/reverse().xml000066400000000000000000000026051265711500300203510ustar00rootroot00000000000000 reverse() Reverse the result set of the API instance. 1.10 reverse() Reverse the result set of the API instance and return the original array. The original API instance with the result set in reversed order. This method will quite simply take the elements in an API instance's result set and reverse the order of those element, in place. This is particularly used when used with the `dt-api sort()` method. This method makes use of the fact that DataTables API objects are "array like", in that they inherent a lot of the abilities and methods of the Javascript `Array` type. In this case, this method is a proxy for the Javascript `Array.prototype.reverse` method and is provided as a utility method for the DataTables API. For more information about the original method, please refer to the [Mozilla MDN documentation for `reverse`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reverse). DataTablesSrc-1.10.11/docs/api/row().cache().xml000066400000000000000000000035771265711500300207010ustar00rootroot00000000000000 row().cache() Get the DataTables cached data for the selected row. 1.10 row().cache( type ) Obtain the data for the row from the selector Specify which cache the data should be read from. Can take one of two values: `dt-string search` or `dt-string order` DataTables API instance with data for each cell in the selected row in the result set. This is a 1D array with each entry being the data for the cells from the selected row. DataTables caches data for searching and ordering in order for those operations to run as quickly as possible when they are required. Cached data is not guaranteed to be available at any particular moment. If DataTables hasn't requested the data, it won't have been cached. This is particularly obvious when using the `-string order` option and a sort hasn't been performed on a column. Invalidation of data will also cause the cache to be removed. It should be noted that this method is required as DataTables has the ability to use different data for its different operations (searching, ordering, display etc) - see `dt-init columns.data` and `dt-init columns.render` for further information. If you don't want the cached data, `dt-api rows().data()` provides access to the original data array / object given to, or created by DataTables. If you aren't using orthogonal data for the different operations of DataTables, then this method is of limited used. Note that this method is primarily aimed at plug-in developers who require access to the internal data that DataTables has stored. row().cache() DataTablesSrc-1.10.11/docs/api/row().child().hide().xml000066400000000000000000000040451265711500300217410ustar00rootroot00000000000000 row().child().hide() Hide child rows after creating new child rows 1.10 row().child().hide() Hide the child row(s) of a parent row DataTables API instance. The `dt-api row().child()` method, when used to set the child row's data, will retain the state of the child row visibility. So if the parent row's children are visible, they will continue to be so after setting use `dt-api row().child()` to set a new value. This method provides a chaining option to quickly and easily hide the child rows after setting the new child row data. Please note that this method is only available when `dt-api row().child()` is called with a parameter set. This is because `dt-api row().child()` will return the child rows if called with no parameters, which is either a `-type jQuery` object or `-type undefined`. When called with a parameter `dt-api row().child()` returns a `-type DataTables.Api` instance. If you need to hide a child row without any parameters being set use `dt-api row().child.hide()`. It is worth saying that this method is probably of limited use, but it is included in the API for completeness! Unlike many of the other methods which manipulate the DataTable, this method does not require `dt-api draw()` to be called for the resulting change to be displayed. The child row(s) are inserted into the table without requiring that DataTables redraw. DataTablesSrc-1.10.11/docs/api/row().child().remove().xml000066400000000000000000000036341265711500300223300ustar00rootroot00000000000000 row().child().remove() Destroy child row(s) for the selected parent row 1.10.1 row().child().remove() Remove child row(s) from display and release any allocated memory DataTables API instance. This method is used to remove child row(s) from a parent row, removing them from the displayed table (if they are currently displayed) and releasing the memory allocated for these rows. Please note that this method is only available when `dt-api row().child()` is called with a parameter set. This is because `dt-api row().child()` will return the child rows if called with no parameters, which is either a `-type jQuery` object or `-type undefined`. When called with a parameter `dt-api row().child()` returns a `-type DataTables.Api` instance. If you need to display a child row without any parameters being set use `dt-api row().child.show()`. Unlike many of the other methods which manipulate the DataTable, this method does not require `dt-api draw()` to be called immediately after. The child row(s) are inserted into the table without requiring that DataTables redraw. DataTablesSrc-1.10.11/docs/api/row().child().show().xml000066400000000000000000000036071265711500300220130ustar00rootroot00000000000000 row().child().show() Make newly defined child rows visible 1.10 row().child().show() Show the child row(s) of a parent row DataTables API instance. When using `dt-api row().child()` to attach child rows to a parent row, you will often want to make the child rows immediately visible. This method provides that ability as a simple chaining method. Please note that this method is only available when `dt-api row().child()` is called with a parameter set. This is because `dt-api row().child()` will return the child rows if called with no parameters, which is either a `-type jQuery` object or `-type undefined`. When called with a parameter `dt-api row().child()` returns a `-type DataTables.Api` instance. If you need to display a child row without any parameters being set use `dt-api row().child.show()`. Unlike many of the other methods which manipulate the DataTable, this method does not require `dt-api draw()` to be called for the resulting change to be displayed. The child row(s) are inserted into the table without requiring that DataTables redraw. DataTablesSrc-1.10.11/docs/api/row().child().xml000066400000000000000000000152161265711500300207120ustar00rootroot00000000000000 row().child() Get / set the child rows of the selected main table row 1.10 row().child() Get the child row(s) that have been set for a parent row jQuery object with the child rows for the parent row in its result set, or `undefined` if there are no child rows set for the parent yet. 1.10.1 row().child( showRemove ) Show or remove and destroy the child rows for the selected row. This parameter can be given as `true` or `false`: * `true`: Any child rows attached to the parent will be immediately made visible. This is the equivalent of using `dt-api row().child.show()`. * `false`: If the parent row has any children currently attached to it (whether shown or not) this method will destroy those child rows, removing them from the DOM if appropriate. Unlike with the `dt-api row().child.hide()` method, this option removes the rows from DataTables held memory completely. This is the equivalent of using `dt-api row().child.remove()`. DataTables API instance row().child( data [, className ] ) Set the data to show in the child row(s). Note that calling this method will replace any child rows which are already attached to the parent row. The data to be shown in the child row can be given in multiple different ways: * `string` - As a string, a single child row is create and the data is inserted into a single cell in that child row. * `node` - As a `dt-tag tr` element, the `dt-tag tr` element is used as the child row. This can be useful it you wish to define multiple columns in the child row. * `jQuery` - A jQuery object with nodes to be added. If there are multiple elements in the jQuery result set, they are added as multiple rows. If the node is `dt-tag tr` element it is treated a the child row, otherwise a row and cell are automatically created and the node from the jQuery result set inserted into it. * `array` - Multiple child rows can be added at a single time by passing any of the above options in as an array. For example you might pass in an array with two string elements in it to create two child rows with the string content used for each. Class name that is added to the `-tag td` cell node(s) of the child row(s) when DataTables generates the child row. As of 1.10.1 it is also added to the `-tag tr` row node of the child row(s). This is useful to add additional styling information to the child row to indicate that while it is part of the table's data, it is additional information beyond what is normally shown. Please note that if a `-type node`, or jQuery object that contains nodes, is given in the first parameter the class name is not automatically added - it is assumed that the existing row is already configured as required. DataTables API instance DataTables has the ability to show child rows for each row (termed a "parent row" in this documentation to distinguish from the child rows). This child rows are attached to each parent row, and can be used, for example, to provide extra information about the parent row, or an editing form. The child rows will always be placed immediately after a parent row (if the child rows are designated to be visible, using the `dt-api row().child.show()` method), regardless of ordering, search terms applied to the table etc. If a parent row is not available in the DataTables' current view, the child rows will not be visible either. The contents of the child rows are entirely independent of the main table (other than their position in the document). Ordering, searching etc applied to the table has no effect on the order of the child rows. Each child row is typically contains a single cell, which has a `colspan` attribute set to span the full table width, so the content of the cell covers the full table width. However, it is also possible to pass in a `dt-tag tr` element which has multiple cells (one for each column in the table) to show the child row data in the same column structure as the main table. A parent row can have one or more child rows attached to it at a time. However, child rows are treated as one entity by the API, which is to say that they can either all be shown, or all hidden. Additionally, a child row can persist after they have been hidden, allowing them to quickly and easily be shown again in future if required. The act of hiding a row is performed using `dt-api row().child.hide()`. A Child row can also be destroyed (hidden and its allocated memory released) using `dt-api row().child.remove()` or this method with `false` as the only parameter, if the child row is no longer required. Note that this method does not automatically make the added child row visible when creating a child row. Use the `dt-api row().child().show()` chained method (or `dt-api row().child.show()` as required). '+ ''+rowIdx+'.1'+ ''+rowIdx+'.2'+ ''+rowIdx+'.3'+ ''+rowIdx+'.4'+ '' ) ) .show(); } ); ]]> DataTablesSrc-1.10.11/docs/api/row().child.hide().xml000066400000000000000000000025751265711500300216260ustar00rootroot00000000000000 row().child.hide() Hide the child row(s) of a parent row 1.10 row().child.hide() Hide the child row(s) of a parent row DataTables API instance. This method can be used to make the child rows of a parent row hidden at any time. When child row(s) are set as hidden they are not detached from the parent row, but rather simply not drawn on the page. This method provides a way of hiding a row at any required time. Unlike many of the other methods which manipulate the DataTable, this method does not require `dt-api draw()` to be called for the resulting change to be displayed. The child row(s) are inserted into the table without requiring that DataTables redraw. DataTablesSrc-1.10.11/docs/api/row().child.isShown().xml000066400000000000000000000024231265711500300223370ustar00rootroot00000000000000 row().child.isShown() Check if the child rows of a parent row are visible 1.10 row().child.isShown() Check if the child rows of a parent row are visible `true` if child rows are visible, `false` otherwise. When working which child rows in DataTables, you may often wish to know if a parent row's child rows are visible or not. This method provides exactly that ability, returning a boolean value indicating if the child rows are visible or not. DataTablesSrc-1.10.11/docs/api/row().child.remove().xml000066400000000000000000000027261265711500300222100ustar00rootroot00000000000000 row().child.remove() Destroy child row(s) for the selected parent row 1.10.1 row().child.remove() Remove child row(s) from display and release any allocated memory DataTables API instance. This method is used to remove child row(s) from a parent row, removing them from the displayed table (if they are currently displayed) and releasing the memory allocated for these rows. Unlike many of the other methods which manipulate the DataTable, this method does not require `dt-api draw()` to be called for the resulting change to be displayed. The child row(s) are inserted into the table without requiring that DataTables redraw. DataTablesSrc-1.10.11/docs/api/row().child.show().xml000066400000000000000000000026011265711500300216630ustar00rootroot00000000000000 row().child.show() Make the child row(s) of a parent row visible 1.10 row().child.show() Show the child row(s) of a parent row DataTables API instance. This method can be used to make the child rows of a parent row visible at any time. Child rows can be attached using `dt-api row().child()` but do not have to be made immediately visible. This method provides the option of making those child rows which have already been attached visible. Unlike many of the other methods which manipulate the DataTable, this method does not require `dt-api draw()` to be called for the resulting change to be displayed. The child row(s) are inserted into the table without requiring that DataTables redraw. DataTablesSrc-1.10.11/docs/api/row().child.xml000066400000000000000000000026411265711500300205670ustar00rootroot00000000000000 row().child Row child method namespace 1.10 DataTables has the ability to show child rows for each row (termed a "parent row" in this documentation to distinguish from the child rows). This child rows are attached to each parent row, and can be used, for example, to provide extra information about the parent row, or an editing form. The child rows will always be placed immediately after a parent row (if the child rows are designated to be visible, using the `dt-api row().child.show()` method), regardless of ordering, search terms applied to the table etc. If a parent row is not available in the DataTables' current view, the child rows will not be visible either. This property is a static object of the DataTables API which is used simply to provide a namespace to its child methods, which are used to control the child row operations in DataTables. Please refer to the documentation for each of those methods for details on how they operate. row().child() row().child().hide() row().child().show() row().child.hide() row().child.isShown() row().child.show() DataTablesSrc-1.10.11/docs/api/row().data().xml000066400000000000000000000054041265711500300205360ustar00rootroot00000000000000 row().data() Get / set the data for the selected row. 1.10 row().data() Get the data for the selected row Data source object for the data source of the row. This will be an array if you use DOM sourced data, otherwise it will be the array / object / instance that is used to populate the table with data. row().data( d ) Set the data for the selected row Data to use for the row. This may be an array, object or Javascript object instance, but must be in the same format as the other data in the table (i.e. if your table uses objects, pass in an object here!). DataTables API instance with the row retrieved by the selector in the result set. This method is used to work with the data in the row retrieved by the `dt-api row()` selector used. It can be used to get existing data, or set new data to be used for the row. Note that when used as a setter, this method sets the data to apply to the table, but does not update the table's internal caches of data until the `dt-api draw()` method is called. This can be done simply as a chained method of the `dt-api row().data()` method's returned object - for example `table.row( 0 ).data( newData ).draw();`. This is done to allow easy optimisation of the table where successive updates can be applied before the table is redrawn. rows().data() cell().data() DataTablesSrc-1.10.11/docs/api/row().id().xml000066400000000000000000000026351265711500300202240ustar00rootroot00000000000000 row().id() Get the id of the selected row. 1.10.8 row().id( [ hash ] ) Get the id of the selected row. * `true` - Append a hash (`#`) to the start of the row id. This can be useful for then using the id as a selector * `false` - Do not modify the id value. Row id. If the row does not have an id available `-type undefined` will be returned. This method can be used to get a row's id, as specified by the row's data and the `dt-init rowId` option. Optionally it can also prepend a hash (`#`) to the row id allowing it to then easily be used as a selector. **Important** This method does not read the DOM id for the `-tag tr` element, but rather gets the row id from the row's data source (location specified by `dt-init rowId`). dt-init rowId dt-api row().id() dt-api rows().ids() DataTablesSrc-1.10.11/docs/api/row().index().xml000066400000000000000000000027571265711500300207440ustar00rootroot00000000000000 row().index() Get the row index of the selected row. 1.10 row().index() Get the row index of the row column. Row index DataTables stores the data for rows and columns in internally indexes which it can utilise for fast operation of ordering, searching etc. It can be useful at times to know what these indexes are, as they can be used for efficient selectors in the `dt-api row()`, `dt-api column()` and other API methods which use selectors. This method is used to retrieve the indexes of the selected rows which can then be used as part of a selector to update data. rows().indexes() DataTablesSrc-1.10.11/docs/api/row().invalidate().xml000066400000000000000000000060521265711500300217450ustar00rootroot00000000000000 row().invalidate() Invalidate the data held in DataTables for the selected row 1.10 row().invalidate( [ source ] ) Invalidate information in the selected row Select a row found by a row selector Data source to read the new data from. By default, DataTables will automatically read the new data for the row from the same source as it was originally read (i.e. DOM sourced or Javascript sourced) but this parameter can be used to override that and tell DataTables specifically which should be used to read in the new data. This might be useful if you are Ajax loading data but use the DOM to modify the contents of cells. This property can take the values: * `-string auto` - use original data source * `-string data` - use the Javascript data structure * `-string dom` - use the data currently held in the DOM DataTables API instance with selected row reference in the result set DataTables holds cached information about the contents of each cell in the table to increase performance of table operations such as ordering and searching. If you were to modify the contents of a cell (for DOM data source tables) or the array / object values (for Ajax / JS source tables) DataTables wouldn't know that this has happened. This method can be used to tell DataTables to re-read the information from the data source for the row (be it from the DOM or objects / arrays - whatever the original data source was). Invalidation of data provides an alternative to using `dt-api row().data()` and `dt-api cell().data()` to update cell values. Typically the `data` methods are preferred over the invalidation methods, as they use less code, but where the invalidation methods really shine is when the data source for the table are external objects which can be updated using that objects own methods and then simply tell DataTables that the data has changed by calling the invalidate method. cells().invalidate() rows().invalidate() DataTablesSrc-1.10.11/docs/api/row().node().xml000066400000000000000000000023511265711500300205500ustar00rootroot00000000000000 row().node() Get the row `dt-tag TR` node for the selected row. 1.10 row().node() Obtain the `dt-tag tr` node for the selected row `dt-tag tr` element of the selected row or null if the element is not yet available This method is used to get the `dt-tag tr` node of row matched by the `dt-api row()` selector used. Please be aware that using `dt-init deferRender` will cause some nodes to be created only when they are required for display, so they might not be immediately available when this method is called. As a singular function, `dt-api row().node()` operates on only a single row and will truncate other rows if more than one is found to match the selector used. Use `dt-api rows().nodes()` if you require to work with multiple rows. rows().nodes() DataTablesSrc-1.10.11/docs/api/row().remove().xml000066400000000000000000000035221265711500300211210ustar00rootroot00000000000000 row().remove() Delete the selected row from the DataTable. 1.10 row().remove() Delete the selected row. `dt-tag tr` row node. This method (and its plural counterpart, `dt-api rows().remove()`) will remove the selected row from the DataTable completely, deleting the allocated memory for data and node from the browser. Please be aware that this method removes the data from the table internally but that action won't be visually shown until the `dt-api draw()` method is called to update the display. This method can called simply as a chained method of the `dt-api rows().remove()` method's returned object - for example `table.rows().remove().draw();`. This method is used to reduce the number of draws required if multiple rows are being deleted for optimisation. rows().remove() clear() DataTablesSrc-1.10.11/docs/api/row().xml000066400000000000000000000032671265711500300175120ustar00rootroot00000000000000 row() Select a single row from a table. 1.10 row( rowSelector [, modifier ] ) Select a row found by a row selector Row selector. Option used to specify how the rows should be ordered, and if paging or search options in the table should be taken into account. DataTables API instance with selected row in the result set Working with rows is a fundamental part of DataTables, and you want to be able to easily select the rows that you want from the table. This method is the rows counter part to the `dt-api columns()` and `dt-api cells()` methods for working with columns and cells in the table, respectively. Using a selector and the `dt-type selector-modifier` option the rows at the table can be obtained with this method's own chained methods providing the ability to get the data from the rows, the row nodes and to invalidate the data, among other actions. Note that if the selector used matches multiple rows, this method will truncate the result to contain just one row, the first matched one. If you require to work with multiple rows at the same time for group manipulation, please use this method's plural counterpart `dt-api rows()` which can select and manipulate multiple rows. rows() DataTablesSrc-1.10.11/docs/api/row.add().xml000066400000000000000000000050611265711500300202330ustar00rootroot00000000000000 row.add() Add a new row to the table. 1.10 row.add( data ) Add a new row to the table using the given data Select a row found by a row selector Data to use for the new row. This may be an array, object, Javascript object instance or a `-tag tr` element. If a data structure is used (i.e. array or object) it must be in the same format as the other data in the table (i.e. if your table uses objects, pass in an object with the same properties here!). DataTables API instance with the newly added row in its result set. Adding new data to a table is central to the concept of being able to dynamically control the content of a DataTable, and this method provides the ability to do exactly that. It will add a single row at a time - for addition of multiple rows, either call this method multiple times, or use this method's plural counterpart: `dt-api rows.add()`. The rows that are added are subjected to the ordering and search criteria that are applied to the table, which will determine the new row's position and visibility in the table. This method will add the data to the table internally, but does not visually update the tables display to account for this new data. In order to have the table's display updated, use the `dt-api draw()` method, which can be called simply as a chained method of the `dt-api row.add()` method's returned object - for example `table.row.add( [ 1, 2, 3, 4 ] ).draw();`. This is done to allow easy optimisation of the table where multiple rows can be added before the table is redrawn. rows.add() DataTablesSrc-1.10.11/docs/api/rows().cache().xml000066400000000000000000000047451265711500300210620ustar00rootroot00000000000000 rows().cache() Get the DataTables cached data for the selected rows. 1.10 rows().cache( type ) Obtain the data for the columns rows the selector Specify which cache the data should be read from. Can take one of two values: `dt-string search` or `dt-string order` DataTables API instance with data for each cell in the selected columns in the result set. This is a 2D array with the top level array entries for each row matched by the `dt-api columns()` selector and the inner arrays representing the cached data for each column (by column data index). DataTables caches data for searching and ordering in order for those operations to run as quickly as possible when they are required. Sometimes it can be useful to get the data that DataTables has cached for these operations (usually more usefully as column data using `dt-api columns().cache()` than on a per-row basis, but this method is included for completeness). Cached data is not guaranteed to be available at any particular moment. If DataTables hasn't requested the data, it won't have been cached. This is particularly obvious when using the `-string order` option and a sort hasn't been performed on a column. Invalidation of data will also cause the cache to be removed. It should be noted that this method is required as DataTables has the ability to use different data for its different operations (searching, ordering, display etc) - see `dt-init columns.data` and `dt-init columns.render` for further information. If you don't want the cached data, `dt-api rows().data()` provides access to the original data array / object given to, or created by DataTables. If you aren't using orthogonal data for the different operations of DataTables, then this method is of limited used. Please note that the order of the data in the returned array and which rows the data is obtained from (searched rows, visible rows etc) is controlled by the `dt-type selector-modifier` option of the `dt-api rows()` selector used to get the selected rows. Note that this method is primarily aimed at plug-in developers who require access to the internal data that DataTables has stored. row().cache() DataTablesSrc-1.10.11/docs/api/rows().data().xml000066400000000000000000000032411265711500300207160ustar00rootroot00000000000000 rows().data() Get the data for the selected rows. 1.10 rows().data() Get the data for the rows from the selector DataTables API instance with data for each row from the selector in the result set. Each entry is the original data source object for that row, be is an array, object or Javascript object instance. This method is used to get the data used for the cells in the rows matched by the selector from DataTables. The order of the data in the returned array and which rows the data is obtained from (searched rows, visible rows etc) is controlled by the `dt-type selector-modifier` option of the `dt-api rows()` selector used to get the selected rows. This method cannot be used to modify data in the table, only to retrieve it. Use the `dt-api row().data()` method instead which can be used as a setter. row().data() DataTablesSrc-1.10.11/docs/api/rows().every().xml000066400000000000000000000074441265711500300211500ustar00rootroot00000000000000 rows().every() Iterate over each selected row, with the function context set to be the row in question. 1.10.6 rows().every( fn ) Iterate over each selected row Function to execute for every row selected. The function's content is set to be an API instance for the row in question. As of DataTables 1.10.8 the function is passed the following parameters: 1. Row index 2. Table loop counter 3. Row loop counter No return value is expected or acted upon. DataTables API instance of the selected rows. A typical operation with the DataTable API is to perform an operation on a collection of rows - a common action is performed on each row, adding event handlers, updating data, etc. This iteration of the rows can be performed a number of ways in DataTables, each with its own advantages: * `dt-api rows().every()` * `dt-api iterator()` * `dt-api each()` This `dt-api rows().every()` method is likely to be the most useful in the majority of cases as it sets the context of the callback function to be the `dt-api row()` instance for the row in question (normally a callback in the DataTables API has its context set to be at the top level API hierarchy). In simple terms this means you have the methods such as `dt-api row().data()` available as `this.data()` in the callback given to this method. Consider the following example using `dt-api each()`, which iterates over the row indexes that have been selected - we are required to get the `dt-api row()` object for each row to be able to work with it directly: ```js table.rows().eq(0).each( function ( index ) { var row = table.row( index ); var data = row.data(); // ... do something with data(), or row.node(), etc } ); ``` Using `dt-api rows().every()` this can be rewritten as: ```js table.rows().every( function ( rowIdx, tableLoop, rowLoop ) { var data = this.data(); // ... do something with data(), or this.node(), etc } ); ``` Although a relatively simple optimisation in terms of code presentation, it can make the code much more readable and intuitive. The other advantage is that the table context is automatically handled - in the first example above where `dt-api each()` is used, the `dt-api eq()` method is used to select the information from the first table in the API's context only, introducing complexity if multiple tables are used. In `dt-api rows().every()` the table context is automatically set to the appropriate table for each row that has been selected. '+ ''+rowIdx+'.1'+ ''+rowIdx+'.2'+ ''+rowIdx+'.3'+ ''+rowIdx+'.4'+ '' ) ) .show(); } ); ]]> columns().every() cells().every() each() iterator() DataTablesSrc-1.10.11/docs/api/rows().ids().xml000066400000000000000000000024551265711500300205720ustar00rootroot00000000000000 rows().ids() Get the ids of the selected rows. 1.10.8 rows().ids( [ hash ] ) Get the ids of the selected rows. * `true` - Append a hash (`#`) to the start of each row id. This can be useful for then using the ids as selectors * `false` - Do not modify the id value. Api instance with the selected rows in its result set. If a row does not have an id available `-type undefined` will be returned as the value. This method can be used to get the id's of the rows selected by the `dt-api rows()` method, as specified by the row's data and the `dt-init rowId` option. Optionally it can also prepend a hash (`#`) to the ids allowing them to then easily be used as selectors. **Important** This method does not read the DOM id for the `-tag tr` elements, but rather gets the row id from the row's data source (location specified by `dt-init rowId`). dt-init rowId dt-api row().id() dt-api rows().ids() DataTablesSrc-1.10.11/docs/api/rows().indexes().xml000066400000000000000000000024711265711500300214500ustar00rootroot00000000000000 rows().indexes() Get the row indexes of the selected rows. 1.10 rows().indexes() Get the rows indexes of the selected rows. DataTables API instance with selected row indexes in the result set. DataTables stores the data for rows and columns in internally indexes which it can utilise for fast operation of ordering, searching etc. It can be useful at times to know what these indexes are, as they can be used for efficient selectors in the `dt-api rows()`, `dt-api columns()` and other API methods which use selectors. This method is used to retrieve the indexes of the selected rows which can then be used as part of a selector to update data. row().index() DataTablesSrc-1.10.11/docs/api/rows().invalidate().xml000066400000000000000000000056571265711500300221420ustar00rootroot00000000000000 rows().invalidate() Invalidate the data held in DataTables for the selected rows 1.10 rows().invalidate( [ source ] ) Invalidate information in the selected rows Data source to read the new data from. By default, DataTables will automatically read the new data for the row from the same source as it was originally read (i.e. DOM sourced or Javascript sourced) but this parameter can be used to override that and tell DataTables specifically which should be used to read in the new data. This might be useful if you are Ajax loading data but use the DOM to modify the contents of cells. This property can take the values: * `-string auto` - use original data source * `-string data` - use the Javascript data structure * `-string dom` - use the data currently held in the DOM DataTables API instance with selected row references in the result set DataTables holds cached information about the contents of each cell in the table to increase performance of table operations such as ordering and searching. If you were to modify the contents of a cell (for DOM data source tables) or the array / object values (for Ajax / JS source tables) DataTables wouldn't know that this has happened. This method can be used to tell DataTables to re-read the information from the data source for the row (be it from the DOM or objects / arrays - whatever the original data source was). This provides an alternative to using `dt-api row().data()` and `dt-api cell().data()` when changing cell values. Typically the `data` methods are preferred over the invalidation methods, as they use less code, but where the invalidation methods really shine is when the data source for the table are external objects which can be updated using that objects own methods. cells().invalidate() row().invalidate() DataTablesSrc-1.10.11/docs/api/rows().nodes().xml000066400000000000000000000025551265711500300211240ustar00rootroot00000000000000 rows().nodes() Get the row `dt-tag TR` nodes for the selected rows. 1.10 rows().nodes() Obtain the `dt-tag tr` nodes for the selected rows DataTables API instance with each row's node from the selected rows in the result set. This method is used to get the nodes of for the row `dt-tag tr` nodes in the rows matched by the selector. Please note that the order of the nodes in the returned array and which rows the nodes are obtained from (searched rows, visible rows etc) is controlled by the `dt-type selector-modifier` option of the `dt-api rows()` selector used to get the selected rows. Furthermore, please be aware that using `dt-init deferRender` will cause some nodes to be created only when they are required for display, so they might not be immediately available when this method is called. row().node() DataTablesSrc-1.10.11/docs/api/rows().remove().xml000066400000000000000000000030271265711500300213040ustar00rootroot00000000000000 rows().remove() Delete the selected rows from the DataTable. 1.10 rows().remove() Delete the selected rows. DataTables API instance. This method (and its singular counterpart, `dt-api row().remove()`) removes the selected rows from the DataTable completely, deleting the allocated memory for data and nodes from the browser. Please be aware that this method removes the data from the table internally but that action won't be visually shown until the `dt-api draw()` method is called to update the display. This method can called simply as a chained method of the `dt-api rows().remove()` method's returned object - for example `table.rows().remove().draw();`. This method is used to reduce the number of draws required if multiple rows are being deleted for optimisation. row().remove() clear() DataTablesSrc-1.10.11/docs/api/rows().xml000066400000000000000000000044701265711500300176720ustar00rootroot00000000000000 rows() Select multiple rows from a table. 1.10 rows( [ modifier ] ) Select all rows Option used to specify how the rows should be ordered, and if paging or search options in the table should be taken into account. DataTables API instance with selected rows rows( rowSelector [, modifier ] ) Select rows found by a row selector Row selector. Option used to specify how the rows should be ordered, and if paging or search options in the table should be taken into account. DataTables API instance with selected rows in the result set Working with rows is a fundamental part of DataTables, and you want to be able to easily select the rows that you want from the table. This method is the rows counter part to the `dt-api columns()` and `dt-api cells()` methods for working with columns and cells in the table, respectively. Using a selector and the `dt-type selector-modifier` option the rows at the table can be obtained with this method's own chained methods providing the ability to get the data from the rows, the row nodes and to invalidate the data, among other actions. While this `dt-api rows()` method provides access to multiple rows with a single call, its plural counterpart `dt-api row()` is used to select and manipulate a single row at a time, allowing finer gain control and additional methods not available in the plural method such as updating data and working with child rows. The method has two forms, reflecting the fact the rows can be selected in multiple different ways as your implementation demands: * All rows (no parameters, or just a `dt-type selector-modifier` option) * Row selector row() DataTablesSrc-1.10.11/docs/api/rows.add().xml000066400000000000000000000054241265711500300204210ustar00rootroot00000000000000 rows.add() Add multiple new rows to the table. 1.10 rows.add( data ) Add new rows to the table using the data given Select a row found by a row selector Array of data elements, with each one describing a new row to be added to the table (i.e. `data.length` is the number of new rows that will be added to the table). Each data element may be an array, object, Javascript object instance or a `-tag tr` element. The data structure given must be in the same format as the other data in the table (i.e. if your table uses objects, pass in an object here!). DataTables API instance with the newly added rows in its result set. Adding new data to a table is central to the concept of being able to dynamically control the content of a DataTable, and this method provides the ability to do exactly that, adding multiple new rows at a time. If you wish to add only a single row at a time, this method's singular counterpart, `dt-api row.add()` can be used. The rows that are added are subjected to the ordering and search criteria that are applied to the table, which will determine the new row's position and visibility in the table. This method will add the data to the table internally, but does not visually update the tables display to account for this new data. In order to have the table's display updated, use the `dt-api draw()` method, which can be called simply as a chained method of the `dt-api row.add()` method's returned object - for example `table.row.add( [ 1, 2, 3, 4 ] ).draw();`. This is done to allow easy optimisation of the table where multiple rows can be added before the table is redrawn. row.add() DataTablesSrc-1.10.11/docs/api/search().xml000066400000000000000000000121121265711500300201350ustar00rootroot00000000000000 search() Search for data in the table. 1.10 search() Get the currently applied global search. If there is more than one table in the API's context, the search term of the first table will be returned. Use `dt-api table()` if you require the search term of a different table in the API's context. The currently applied global search. This may be an empty string if no search is applied. search( input [, regex[ , smart[ , caseInsen ]]] ) Set the global search to use on the table. Note this doesn't actually perform the search, but rather queues it up - use `dt-api draw()` to perform the search and display the result. Search string to apply to the table. Treat as a regular expression (`true`) or not (default, `false`). Perform smart search (default, `true`) or not (`false`). See below for a description of smart searching. Note that to perform a smart search, DataTables uses regular expressions, so if enable regular expressions using the second parameter to this method, you will likely want to disable smart searching as the two regular expressions might otherwise conflict and cause unexpected results. Do case-insensitive matching (default, `true`) or not (`false`). DataTables API instance The ability to search a table for data is core to the concept of DataTables, as it allows data to be easily accessed by users. This method provides the ability to control the global search of a table through the API. The global search is performed across all searchable columns (see `dt-init columns.searchable` to disable searching for certain columns). If data is found matching in any column, then the whole row is matched and shown in the result set. Searching on individual columns can be performed using the `dt-api columns().search()` and `dt-api column().search()` methods. DataTables has a built in search algorithm referred to as "smart" searching and is designed to make searching the table data, easy to use for the end user. A smart search in DataTables provides the following abilities: * Match words out of order. For example if you search for `-string Allan Fife` it would match a row containing the words `-string Allan` and `-string Fife`, regardless of the order or position that they appear in the table. * Partial word matching. As DataTables provides on-the-fly filtering with immediate feedback to the user, parts of words can be matched in the result set. For example `-string All` will match `-string Allan`. * Preserved text. DataTables 1.10 adds the ability to search for an exact phrase by enclosing the search text in double quotes. For example `-string "Allan Fife"` will match only text which contains the phrase `-string Allan Fife`. It will not match `-string Allan is in Fife`. The smart search ability of DataTables is performed using a regular expression and can be enabled or disabled using the third parameter of this method. If you wish to use a custom regular expression, for example to perform whole word exact matching, you would need to enable the regular expression option (second parameter) and disable the smart search option (third parameter) to ensure that the two do not conflict. DataTables provides a utility method (`dt-api $.fn.dataTable.util.escapeRegex()`) to escape regular expression special characters, which can be useful if you mix user input with regular expressions. Note that this search ability in DataTables is actually technically a filter since it is subtractive. However, we term is a search to avoid naming conflict with the `dt-api filter` helper method. Please be aware that this method sets the search to apply to the table only - it does not actually perform the search. In order to have the search performed and the result shown, use the `dt-api draw()` method, which can be called simply as a chained method of the `dt-api search()` method's returned object - for example `table.search( 'Fred' ).draw();`. This is to provide the ability to queue multiple changes before performing a draw. element $('#myInput').on( 'keyup', function () { table.search( this.value ).draw(); } ); ]]> searching columns.searchable columns().search() column().search() $.fn.dataTable.util.escapeRegex() DataTablesSrc-1.10.11/docs/api/settings().xml000066400000000000000000000027561265711500300205450ustar00rootroot00000000000000 settings() Obtain the table's settings object 1.10 settings() Get the settings object for the table's in the API instance's context. DataTables API instance with the settings objects for the tables in the context in the result set DataTables keeps information about the state of each table in an individual settings object. This object is unique to each table, and each table has only one settings object, even if there are multiple references to the table (i.e. multiple API instances). The information in this object is generally considered to be private and should not be used directly. It absolutely should not have settings written to unless you know the DataTables internals well enough to know the effect of what writing to a property will have. Generally speaking, use the information from the documented public API methods rather than that in this settings object, as the properties in it may change between versions. If you must use a settings object parameter, use an API plug-in to obtain the data, so in future you can update just that plug-in if the parameters do change in a future version of DataTables. This method is provided for plug-in authors who do require access to the internal settings of a table. DataTablesSrc-1.10.11/docs/api/shift().xml000066400000000000000000000027471265711500300200220ustar00rootroot00000000000000 shift() Remove the first item from an API instance's result set. 1.10 shift() Remove the first item from an API instance's result set. Item removed form the result set (was previously the first item in the result set). Just as with Javascript arrays', since the DataTables API object is "array like", items can be removed from a result set using this method. *Shifting* a result, shifts the item off the start of the result set. The API instance's result set is reduced in length by 1 and the item that was removed is returned from the function call. `dt-api pop()` can be used to perform the same action, but at the end of the array, if required. This method is a proxy for the Javascript `Array.prototype.shift` method and is provided as a utility method for the DataTables API. For more information about the original method, please refer to the [Mozilla MDN documentation for `shift`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/shift). DataTablesSrc-1.10.11/docs/api/sort().xml000066400000000000000000000037621265711500300176720ustar00rootroot00000000000000 sort() Sort the elements of the API instance's result set. 1.10 sort( [ fn ] ) Sort the elements of the API instance's result set. This is a standard Javascript sort comparison function. It accepts two parameters: * Value 1 to compare * Value 2 to compare And expects a return which indicated the sorted position of the two values. Less that 0 indicates that the first value comes before the second, greater than 0 indicates that the first value comes after the second and a return of 0 indicates that they are identical. The original API instance with the result set sorted as defined by the sorting conditions used. The `dt-api sort()` method provides a way of sorted the data in an API instance's result set, which can be particularly useful if you then want to use that data for displaying to the end user - for example as a `dt-tag select` list for a search input. This method should not be confused with `dt-api order()` which is used to order for records in the DataTable. This method makes use of the fact that DataTables API objects are "array like", in that they inherent a lot of the abilities and methods of the Javascript `Array` type. In this case, this method is a proxy for the Javascript `Array.prototype.sort` method and is provided as a utility method for the DataTables API. For more information about the original method, please refer to the [Mozilla MDN documentation for `sort`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort). DataTablesSrc-1.10.11/docs/api/splice().xml000066400000000000000000000044121265711500300201530ustar00rootroot00000000000000 splice() Modify the contents of an Api instance's result set, adding or removing items from it as required. 1.10 splice( index, howMany [, value_1 [, ... ] ] ) Modify the contents of an Api instance's result set, adding or removing items from it as required. Index at which to start modifying the Api instance's result set. Number of elements to remove from the result set. This can be 0 if you wish to only add new items. Item to add to the result set at the index specified by the first parameter. Multiple items can be added in a single call by adding them as additional parameters. An array of the items which were removed. If no elements were removed, an empty array is returned. The methods of `dt-api pop()`, `dt-api shift()` etc can be useful to modify an Api instance's result set, but they are restricted to operating at the start of the end of the result set. This method can be used to modify the result set at any point. This method makes use of the fact that DataTables API objects are "array like", in that they inherent a lot of the abilities and methods of the Javascript `Array` type. In this case, this method is a proxy for the Javascript `Array.prototype.splice` method and is provided as a utility method for the DataTables API. For more information about the original method, please refer to the [Mozilla MDN documentation for `splice`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice). = 0 ) { data.splice( idx, 1, 33 ); } ]]> DataTablesSrc-1.10.11/docs/api/state().xml000066400000000000000000000051361265711500300200200ustar00rootroot00000000000000 state() Get the last saved state of the table 1.10.1 state() Get the last saved state of the table State saved object When state saving is enabled (`dt-init stateSave`) it can be useful to know what state has been saved for a table an any one specific moment. This method provides the ability to get the last data object that has been stored in by the state saving mechanism. The data object has the following format, but please be aware that plug-ins and extensions to DataTables can modify this structure by adding data as they require for their own state information. ```js { "time": {number} // Time stamp of when the object was created "start": {number} // Display start point "length": {number} // Page length "order": {array} // 2D array of column ordering information (see `order` option) "search": { "search": {string} // Search term "regex": {boolean} // Indicate if the search term should be treated as regex or not "smart": {boolean} // Flag to enable DataTables smart search "caseInsensitive": {boolean} // Case insensitive flag }, "columns" [ { "visible": {boolean} // Column visibility "search": {} // Object containing column search information. Same structure as `search` above } ] } ``` Please note that this method gives the last saved state, which is not necessarily the current state. For example the `dt-api page()` method will not automatically trigger a state save. Calling `dt-api draw()` will trigger a state save, or use `dt-api state.save()`. state.clear() state.loaded() state.save() stateSave stateSaveCallback stateLoadCallback stateLoadParams stateSaveParams stateLoaded stateLoaded stateLoadParams stateSaveParams DataTablesSrc-1.10.11/docs/api/state.clear().xml000066400000000000000000000032231265711500300211000ustar00rootroot00000000000000 state.clear() Clear the saved state of the table. 1.10.1 state.clear() Clear the saved state of the table The API instance that was used, available for chaining. This method provides the ability to destroy a DataTables saved state which can be useful during development, or potentially when logging a user out if you want to clear the saved state before the state expires (`dt-init stateDuration`). This method will trigger a DataTables state save but with an empty object (i.e. `{}`), effectively erasing any existing state data. Note that if DataTables saves state after this method is called, the state will be stored again (a draw is the most common method of triggering a state save). state() state.loaded() state.save() stateSave stateSaveCallback stateLoadCallback stateLoadParams stateSaveParams stateLoaded stateLoaded stateLoadParams stateSaveParams DataTablesSrc-1.10.11/docs/api/state.loaded().xml000066400000000000000000000031511265711500300212420ustar00rootroot00000000000000 state.loaded() Get the table state that was loaded during initialisation. 1.10.1 state.loaded() Get the table state that was loaded during initialisation State saved object. See `dt-api state()` for the object format. This method is primarily made available for plug-in authors who wish to get the state of a DataTable when it is initialised to restore state saved functionality of their own plug-in. The structure of the object returned by this method matches the state object, as defined by `dt-api state()`. state() state.clear() state.save() stateSave stateSaveCallback stateLoadCallback stateLoadParams stateSaveParams stateLoaded stateLoaded stateLoadParams stateSaveParams DataTablesSrc-1.10.11/docs/api/state.save().xml000066400000000000000000000032431265711500300207520ustar00rootroot00000000000000 state.save() Trigger a state save. 1.10.1 state.save() Trigger a state save The API instance that was used, available for chaining. This method is primarily made available for plug-in authors who wish to be able to add information to the DataTables state saving object (through `dt-event stateSaveParams`) and want to be able to trigger a save save to save information specific to their plug-in. As an example, a column filter plug-in might trigger a state save when the input values for the filter are altered by the end user. This enables the author to reliably restore the state of their plug-in when the table is next initialised (`dt-api state.loaded()`). state() state.clear() state.loaded() stateSave stateSaveCallback stateLoadCallback stateLoadParams stateSaveParams stateLoaded stateLoaded stateLoadParams stateSaveParams DataTablesSrc-1.10.11/docs/api/table().body().xml000066400000000000000000000021621265711500300210400ustar00rootroot00000000000000 table().body() Get the `dt-tag tbody` node for the table in the API's context 1.10 table().body() Get the `dt-tag tbody` node HTML `dt-tag tbody` node. DataTables and its plug-ins can create additional tables in the document. For example when scrolling is enable, the table is split into three individual tables, the footer, footer and body in order to provide cross-browser scrolling, while FixedHeader / FixedColumns create cloned tables for static positioning. This method, and its plural counterpart, are provided to give easy access to the original `dt-tag tbody` element for DOM manipulation. tables().body() DataTablesSrc-1.10.11/docs/api/table().container().xml000066400000000000000000000020551265711500300220660ustar00rootroot00000000000000 table().container() Get the `-tag div` container node for the table in the API's context 1.10.1 table().container() Get the `-tag div` container node HTML `-tag div` node. DataTables places the main table and all of the various component display controls for the table inside a container element, a `-tag div` element with a class of `-string dataTables_wrapper` (by default). This method, and its plural counterpart, provide the ability to obtain that container node, which can be used by plug-in authors to add additional controls to the table. tables().containers() DataTablesSrc-1.10.11/docs/api/table().footer().xml000066400000000000000000000021671265711500300214060ustar00rootroot00000000000000 table().footer() Get the `dt-tag tfoot` node for the table in the API's context 1.10 table().footer() Get the `dt-tag tfoot` node HTML `dt-tag tfoot` node. DataTables and its plug-ins can create additional tables in the document. For example when scrolling is enable, the table is split into three individual tables, the header, footer and body in order to provide cross-browser scrolling, while FixedHeader / FixedColumns create cloned tables for static positioning. This method, and its plural counterpart, are provided to give easy access to the original `dt-tag tfoot` element for DOM manipulation. tables().footer() DataTablesSrc-1.10.11/docs/api/table().header().xml000066400000000000000000000021721265711500300213340ustar00rootroot00000000000000 table().header() Get the `dt-tag thead` node for the table in the API's context 1.10 table().header() Get the `dt-tag thead` node HTML `dt-tag thead` node. DataTables and its plug-ins can create additional tables in the document. For example when scrolling is enable, the table is split into three individual tables, the header, footer and body in order to provide cross-browser scrolling, while FixedHeader / FixedColumns create cloned tables for static positioning. This method, and its plural counterpart, are provided to give easy access to the original `dt-tag thead` element for DOM manipulation. tables().header() DataTablesSrc-1.10.11/docs/api/table().node().xml000066400000000000000000000021221265711500300210240ustar00rootroot00000000000000 table().node() Get the `dt-tag table` node for the table in the API's context 1.10 table().node() Get the `dt-tag table` node HTML `dt-tag table` node for the selected table. DataTables and its plug-ins can create additional `dt-tag table` elements in the document (for example when scrolling is enable, the table is split into three individual tables, the header, footer and body in order to provide cross-browser scrolling). However, you may wish to obtain the original table node that belongs to the DataTable. This method, and its plural counterpart, is provided for that purpose. tables().nodes() DataTablesSrc-1.10.11/docs/api/table().xml000066400000000000000000000044771265711500300177760ustar00rootroot00000000000000 table() Select a table based on a selector from the API's context 1.10 table( selector ) Select a table based on the given selector Table selector to select which table you want to operate on. DataTables API instance with selected table in its context. The DataTables API can operate on multiple tables at a single time - the tables in the "context". As a quick example `$('.dataTable').DataTable().search('Fred').draw();` will filter all tables which were found by the class `dataTable`. The context of an API instance defines which DataTable tables the API will operate on and this method provides one way to control what tables are in that context. This ability to operate on multiple tables can be particularly useful if you have many tables on a single page, but you might also wish to reduce the table's in the API's context to operate on just one, or some other subset of the tables. If you are working with single table API instances only, then this method will be of limited use to you! It is really only appropriate when working with multiple tables. Additionally, please note that there is no option that this selector can perform over using jQuery directly on the DOM to select tables. It is mainly provided for convenience and completeness of the API. Note that if the selector used matches more than one table in API's context, the returned API instance's context will be truncated to the first matched table. tables() DataTablesSrc-1.10.11/docs/api/tables().body().xml000066400000000000000000000023221265711500300212210ustar00rootroot00000000000000 tables().body() Get the `dt-tag tbody` nodes for the tables in the API's context 1.10 tables().body() Get the `dt-tag tbody` nodes DataTables API instance with the table body nodes from the selected tables in the result set. DataTables and its plug-ins can create additional tables in the document. For example when scrolling is enable, the table is split into three individual tables, the header, footer and body in order to provide cross-browser scrolling, while FixedHeader / FixedColumns create cloned tables for static positioning. This method, and its singular counterpart, are provided to give easy access to the original `dt-tag tbody` elements for DOM manipulation. table().body() DataTablesSrc-1.10.11/docs/api/tables().containers().xml000066400000000000000000000022431265711500300224330ustar00rootroot00000000000000 tables().containers() Get the `-tag div` container nodes for the tables in the API's context 1.10.1 tables().containers() Get the `-tag div` container nodes DataTables API instance with the container nodes from the selected tables in the result set. DataTables places the main table and all of the various component display controls for the table inside a container element, a `-tag div` element with a class of `-string dataTables_wrapper` (by default). This method provides the ability to obtain that node for all tables in the API instance's context, which can be used by plug-in authors to add additional controls to the table. table().container() DataTablesSrc-1.10.11/docs/api/tables().footer().xml000066400000000000000000000023341265711500300215650ustar00rootroot00000000000000 tables().footer() Get the `dt-tag tfoot` nodes for the tables in the API's context 1.10 tables().footer() Get the `dt-tag tfoot` nodes DataTables API instance with the table footer nodes from the selected tables in the result set. DataTables and its plug-ins can create additional tables in the document. For example when scrolling is enable, the table is split into three individual tables, the header, footer and body in order to provide cross-browser scrolling, while FixedHeader / FixedColumns create cloned tables for static positioning. This method, and its singular counterpart, are provided to give easy access to the original `dt-tag tfoot` elements for DOM manipulation. table().footer() DataTablesSrc-1.10.11/docs/api/tables().header().xml000066400000000000000000000023341265711500300215170ustar00rootroot00000000000000 tables().header() Get the `dt-tag thead` nodes for the tables in the API's context 1.10 tables().header() Get the `dt-tag thead` nodes DataTables API instance with the table header nodes from the selected tables in the result set. DataTables and its plug-ins can create additional tables in the document. For example when scrolling is enable, the table is split into three individual tables, the header, footer and body in order to provide cross-browser scrolling, while FixedHeader / FixedColumns create cloned tables for static positioning. This method, and its singular counterpart, are provided to give easy access to the original `dt-tag thead` elements for DOM manipulation. table().header() DataTablesSrc-1.10.11/docs/api/tables().nodes().xml000066400000000000000000000022301265711500300213720ustar00rootroot00000000000000 tables().nodes() Get the `dt-tag table` nodes for the tables in the API's context 1.10 tables().nodes() Get the `dt-tag table` nodes DataTables API instance with the table nodes from the selected tables in the result set. DataTables and its plug-ins can create additional `dt-tag table` elements in the document (for example when scrolling is enable, the table is split into three individual tables, the header, footer and body in order to provide cross-browser scrolling). However, you may wish to obtain the original table node that belongs to the DataTable. This method, and its singular counterpart, is provided for that purpose. table().node() DataTablesSrc-1.10.11/docs/api/tables().xml000066400000000000000000000046411265711500300201520ustar00rootroot00000000000000 tables() Select tables based on a selector from the API's context 1.10 tables() Select all tables DataTables API instance with all tables in the current context. tables( selector ) Select tables based on the given selector Table selector to select which tables you want to operate on. DataTables API instance with selected tables in its context. The DataTables API can operate on multiple tables at a single time - the tables in the "context". As a quick example `$('.dataTable').DataTable().search('Fred').draw();` will filter all tables which were found by the class `dataTable`. The context of an API instance defines which DataTable tables the API will operate on and this method provides one way to control what tables are in that context. This ability to operate on multiple tables can be particularly useful if you have many tables on a single page, but you might also wish to reduce the table's in the API's context to operate on just one, or some other subset of the tables. If you are working with single table API instances only, then this method will be of limited use to you! It is really only appropriate when working with multiple tables. Additionally, please note that there is no option that this selector can perform over using jQuery directly on the DOM to select tables. It is mainly provided for convenience and completeness of the API. table() DataTablesSrc-1.10.11/docs/api/to$().xml000066400000000000000000000024411265711500300173620ustar00rootroot00000000000000 to$() Convert the API instance to a jQuery object, with the objects from the instance's result set in the jQuery result set. 1.10 to$() Create a jQuery object from an API instance. jQuery object which contains the values from the API instance's result set. This method will create a jQuery object from the contents of the API instance's result set. This of primary use when working with the `nodes()` functions of the API such as `dt-api rows().nodes()`, `dt-api column().nodes()` and `dt-api cells().nodes()`, where it can be useful to easily convert the API instance into an jQuery object, working with the nodes using the chaining methods provided by jQuery. Please note that `dt-api to$()` and `dt-api toJQuery()` are identical in functionality. Both methods are provided to cater for the two common forms of how jQuery is used. DataTablesSrc-1.10.11/docs/api/toArray().xml000066400000000000000000000023571265711500300203230ustar00rootroot00000000000000 toArray() Create a native Javascript array object from an API instance. 1.10 toArray() Create a native Javascript array from an API instance. Javascript array which contains the values from the API instance's result set. The DataTables API object provides a lot of the methods that you would expect to find in a native Javascript array and generally acts a lot like an array, but there are times when you want to work directly with a Javascript array rather than a DataTables API instance. This method can be used to create a native Javascript array which contains the same items as contained in the API instance's result set. This method makes use of the fact that DataTables API objects are "array like", in that they inherent a lot of the abilities and methods of the Javascript `Array` type. DataTablesSrc-1.10.11/docs/api/toJQuery().xml000066400000000000000000000024661265711500300204650ustar00rootroot00000000000000 toJQuery() Convert the API instance to a jQuery object, with the objects from the instance's result set in the jQuery result set. 1.10 toJQuery() Create a jQuery object from an API instance. jQuery object which contains the values from the API instance's result set. This method will create a jQuery object from the contents of the API instance's result set. This is primarily of use when working with the `nodes()` functions of the API such as `dt-api rows().nodes()`, `dt-api column().nodes()` and `dt-api cells().nodes()`, where it can be useful to easily convert the API instance into an jQuery object, working with the nodes using the chaining methods provided by jQuery. Please note that `dt-api to$()` and `dt-api toJQuery()` are identical in functionality. Both methods are provided to cater for the two common forms of how jQuery is used. DataTablesSrc-1.10.11/docs/api/unique().xml000066400000000000000000000024001265711500300201750ustar00rootroot00000000000000 unique() Create a new API instance containing only the unique items from a the elements in an instance's result set. 1.10 unique() Create a new API instance containing only the unique items from a the elements in an instance's result set. New Api instance which contains the unique items from the original instance's result set, in its own result set. It is often useful to know what data is available in a result set, with duplicate items removed (for example creating a `dt-tag select` list for use as a search input). Although unique items can be found quite trivially with a loop, this utility function provides that ability for you in one simple method. This method makes use of the fact that DataTables API objects are "array like", in that they inherent a lot of the abilities and methods of the Javascript `Array` type. DataTablesSrc-1.10.11/docs/api/unshift().xml000066400000000000000000000032771265711500300203640ustar00rootroot00000000000000 unshift() Add one or more items to the start of an API instance's result set. 1.10 unshift( value_1 [, value_2 [, ...] ] ) Add one or more items to the start of an API instance's result set. Item to add to the API instance's result set. Additional item(s) to add to the API instance's result set. Use as many parameters as you require to add additional items. The length of the modified API instance Just as with Javascript arrays', since the DataTables API object is "array like", items can be added to a result set using this method. *Unshifting* an item onto an API instance adds it to the start of the result set. Items can be added at the end of the result set using `dt-api push()` if required. This method is a proxy for the Javascript `Array.prototype.unshift` method and is provided as a utility method for the DataTables API. For more information about the original method, please refer to the [Mozilla MDN documentation for `unshift`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/unshift). DataTablesSrc-1.10.11/docs/event/000077500000000000000000000000001265711500300164005ustar00rootroot00000000000000DataTablesSrc-1.10.11/docs/event/column-sizing.xml000066400000000000000000000024701265711500300217230ustar00rootroot00000000000000 column-sizing Column sizing event - fired when the column widths are recalculated. 1.10 function( e, settings ) jQuery event object DataTables settings object HTML table element This event is fired whenever DataTables adjusts the column widths in the table and can be used by plug-ins to adjust any additional DOM elements they might have drawn on the page to take account of those changes. Please note that, as with all DataTables emitted events, this event is triggered with the `dt` namespace. As such, to listen for this event, you must also use the `dt` namespace by simply appending `.dt` to your event name, as shown in the example below. autoWidth columns.adjust() DataTablesSrc-1.10.11/docs/event/column-visibility.xml000066400000000000000000000044111265711500300226040ustar00rootroot00000000000000 column-visibility Column visibility event - fired when the visibility of a column changes. 1.10 function( e, settings, column, state ) jQuery event object DataTables settings object Column index that has changed state Column visibility state: `false` if column now hidden, or `true` if visible Column width recalculation: `false` if no column width calculation was performed when the column was hidden (i.e. the second parameter of `dt-api column().visible()` was `false`), otherwise, `true` or `undefined` indicating that the column widths were recalculated. This can be useful to improve performance when the visibility of multiple columns is modified. The `dt-api columns.adjust()` method should be called once all columns have had their visibility state set. HTML table element This event is fired whenever a column's visibility is altered through the `dt-api column().visible()` method and can be useful for plug-ins which work with columns to identify changes in column visibility state and update their own state to take account of the change. Please note that, as with all DataTables emitted events, this event is triggered with the `dt` namespace. As such, to listen for this event, you must also use the `dt` namespace by simply appending `.dt` to your event name, as shown in the example below. columns.visible column().visible() columns().visible() DataTablesSrc-1.10.11/docs/event/destroy.xml000066400000000000000000000030321265711500300206110ustar00rootroot00000000000000 destroy Table destroy event - fired when a table is destroyed. 1.10 function( e, settings ) jQuery event object DataTables settings object HTML table element The `dt-event destroy` event is fired when a DataTable is torn down, to be replaced with an enhanced HTML table (or simply removed from the DOM altogether). This can be used to remove bound events, added DOM nodes etc and can be particularly useful for plug-in authors. This event is fired when the DataTable is destroyed by calling `dt-api destroy` API method or passing the `dt-init destroy` parameter in the initialisation object. Please note that, as with all DataTables emitted events, this event is triggered with the `dt` namespace. As such, to listen for this event, you must also use the `dt` namespace by simply appending `.dt` to your event name, as shown in the example below. destroy destroy() DataTablesSrc-1.10.11/docs/event/draw.xml000066400000000000000000000031521265711500300200600ustar00rootroot00000000000000 draw Draw event - fired once the table has completed a draw. 1.10 function( e, settings ) jQuery event object DataTables settings object HTML table element It can be useful to take an action on every draw event of the table - for example you might want to update an external control with the newly displayed data, or with server-side processing is enabled you might want to assign events to the newly created elements. This event is available to give exactly this information. The `dt-event draw` event is fired whenever the table is redrawn on the page, at the same point as `dt-init drawCallback` (technically the callback fires before the event, but they occur sequentially and thus either can be used to achieve the same effect). Please note that, as with all DataTables emitted events, this event is triggered with the `dt` namespace. As such, to listen for this event, you must also use the `dt` namespace by simply appending `.dt` to your event name, as shown in the example below. drawCallback draw() DataTablesSrc-1.10.11/docs/event/error.xml000066400000000000000000000042271265711500300202600ustar00rootroot00000000000000 error Error event - An error has occurred during DataTables' processing of data. 1.10.5 function( e, settings, techNote, message ) jQuery event object DataTables settings object Tech note error number - use `http://datatables.net/tn/{techNote}` to look up a description Description of error HTML table element Error control is an important consideration in any complex application, and DataTables provides this event to allow you to hook your application's own error handling into DataTables. For example you could trigger an Ajax call that will log an error for investigation, or use the error event to show a custom error message to the end user. This event goes hand in hand with the `dt-init $.fn.dataTable.ext.errMode` option which controls how DataTables handles errors. That static option can take one of four values: * `-string alert` (default) - Alert the error * `-string throw` - Throw a Javascript error * `-string none` - Do nothing (you would want to use this `dt-event error` in this case) * `function` - A function common to all DataTables on the page that is called when an error occurs. Please note that, as with all DataTables emitted events, this event is triggered with the `dt` namespace. As such, to listen for this event, you must also use the `dt` namespace by simply appending `.dt` to your event name, as shown in the example below. dt-init $.fn.dataTable.ext.errMode DataTablesSrc-1.10.11/docs/event/init.xml000066400000000000000000000037541265711500300200760ustar00rootroot00000000000000 init Initialisation complete event - fired when DataTables has been fully initialised and data loaded. 1.10 function( e, settings, json ) jQuery event object DataTables settings object JSON data retrieved from the server, if Ajax loading data HTML table element The `dt-event init` event is the event compliment of the `dt-init initComplete` initialisation option. Like the callback, the `dt-event init` event is called when your table has fully been initialised, data loaded and drawn, which can be particularly useful when using an `dt-init ajax` data source. In such a case, the table will complete its initial run before the data has been loaded (Ajax is asynchronous after all!) so this callback is provided to let you know when the data is fully loaded. The `dt-event init` event is fired at the same point as `dt-init initComplete` (technically the callback fires before the event, but they occur sequentially and thus either can be used to achieve the same effect). Please note that, as with all DataTables emitted events, this event is triggered with the `dt` namespace. As such, to listen for this event, you must also use the `dt` namespace by simply appending `.dt` to your event name, as shown in the example below. dt-init initComplete dt-event preInit DataTablesSrc-1.10.11/docs/event/length.xml000066400000000000000000000027321265711500300204070ustar00rootroot00000000000000 length Page length change event - fired when the page length is changed. 1.10 function( e, settings, len ) jQuery event object DataTables settings object New page length HTML table element The `dt-event length` event is fired whenever the table's page length is changed. This can be through user interaction with the built in page length control, or via the API. Please note that, as with all DataTables emitted events, this event is triggered with the `dt` namespace. As such, to listen for this event, you must also use the `dt` namespace by simply appending `.dt` to your event name, as shown in the example below. paging pagingType page() page.info() page.len() page DataTablesSrc-1.10.11/docs/event/order.xml000066400000000000000000000034511265711500300202400ustar00rootroot00000000000000 order order event - fired when the data contained in the table is ordered. 1.10 function( e, settings ) jQuery event object DataTables settings object HTML table element The `dt-event order` event is fired whenever the data in the table is ordered. This is typically triggered by the end user ordering a column, but can also be initiated through the `dt-api order()` method and when a full redraw (by calling the `dt-api draw()`) occurs. Note that the `dt-event page` will be fired before the table has been redrawn with the updated data, although the data will internally have been ordered. Please note that, as with all DataTables emitted events, this event is triggered with the `dt` namespace. As such, to listen for this event, you must also use the `dt` namespace by simply appending `.dt` to your event name, as shown in the example below. ordering columns.orderable draw() order() column().order() columns().order() DataTablesSrc-1.10.11/docs/event/page.xml000066400000000000000000000031541265711500300200410ustar00rootroot00000000000000 page Page change event - fired when the table's paging is updated. 1.10 function( e, settings ) jQuery event object DataTables settings object HTML table element The `dt-event page` event is fired the table's paging state changes. This can be the end user selecting the page to view or the page length from the built-in controls, or when the page state is altered by the API (`dt-api page()`). Note that the `dt-event page` will be fired before the table has been redrawn with the updated data. Please note that, as with all DataTables emitted events, this event is triggered with the `dt` namespace. As such, to listen for this event, you must also use the `dt` namespace by simply appending `.dt` to your event name, as shown in the example below. paging pagingType page() page.info() page.len() length DataTablesSrc-1.10.11/docs/event/preInit.xml000066400000000000000000000031011265711500300205270ustar00rootroot00000000000000 preInit Initialisation started event - triggered immediately before data load. 1.10.8 function( e, settings ) jQuery event object DataTables settings object HTML table element This event is emitted by DataTables when a table is being initialised and is about to request data. At the point of being fired the table will have its columns and features initialised, but no data will have been loaded (either by Ajax, or reading from the DOM). Its primary purpose is to allow authors of extensions to DataTables be add a listener to the document so some action can be taken before data is loaded (for example modifying the amount of data to be loaded). Please note that, as with all DataTables emitted events, this event is triggered with the `dt` namespace. As such, to listen for this event, you must also use the `dt` namespace by simply appending `.dt` to your event name, as shown in the example below. dt-init initComplete dt-event init DataTablesSrc-1.10.11/docs/event/preXhr.xml000066400000000000000000000037041265711500300203760ustar00rootroot00000000000000 preXhr Ajax event - fired before an Ajax request is made 1.10 function( e, settings, json ) jQuery event object DataTables settings object Data that will be sent to the server in an object form HTML table element This event is triggered _prior_ to DataTables making an Ajax request to the server for data, and is thus the counterpart to the `dt-event xhr` event which is triggered _after_ the Ajax request has successfully returned data from the server. The `dt-event preXhr` event is designed for use by plug-in authors who can listen for this event in their extension and send any additional data that might be required. It is very similar to the `dt-init ajax.data` in this ability, with that option typically being used by those writing initialisation code for their table, rather than plug-in authors. Please note that, as with all DataTables emitted events, this event is triggered with the `dt` namespace. As such, to listen for this event, you must also use the `dt` namespace by simply appending `.dt` to your event name, as shown in the example below. ajax ajax.data ajax.json() xhr DataTablesSrc-1.10.11/docs/event/processing.xml000066400000000000000000000033431265711500300213010ustar00rootroot00000000000000 processing Processing event - fired when DataTables is processing data 1.10 function( e, settings, processing ) jQuery event object DataTables settings object Processing flag: `true` when processing, `false` otherwise. HTML table element This event is fired when DataTables is doing some kind of processing - be it, sorting, filtering or any other kind of data processing. It can be used to indicate to the end user that there is something happening, or that something has finished. Note that this event is used by DataTables' `dt-init processing` display option, and can be useful if you want to replace the DataTables built-in processing indicator with a custom indicator - one which is used in other parts of your application for example. Please note that, as with all DataTables emitted events, this event is triggered with the `dt` namespace. As such, to listen for this event, you must also use the `dt` namespace by simply appending `.dt` to your event name, as shown in the example below. processing DataTablesSrc-1.10.11/docs/event/search.xml000066400000000000000000000034261265711500300203740ustar00rootroot00000000000000 search Search event - fired when the table is filtered. 1.10 function( e, settings ) jQuery event object DataTables settings object HTML table element The `dt-event search` event is fired whenever the table's searching is triggered by the global search or columns search options, including calls from the API (`dt-api search()` for example). Additionally, a full redraw (by calling the `dt-api draw()`) method will cause the table to be re-searched. Note that the `dt-event search` will be fired before the table has been redrawn with the updated filtered data, although the data will internally have been filtered. Please note that, as with all DataTables emitted events, this event is triggered with the `dt` namespace. As such, to listen for this event, you must also use the `dt` namespace by simply appending `.dt` to your event name, as shown in the example below. searching search columns.searchable draw() search() column().search() columns().search() DataTablesSrc-1.10.11/docs/event/stateLoadParams.xml000066400000000000000000000043271265711500300222140ustar00rootroot00000000000000 stateLoadParams State load event - fired when loading state from storage. 1.10 function( e, settings, json ) jQuery event object DataTables settings object State information read from storage HTML table element The `dt-event stateLoadParams` event is the event compliment of the `dt-init stateLoadParams` initialisation option. As with the callback, the event is fired when the table is loading state from the stored data, but prior to that read data being applied to the data table. This allows modification of the saved state data. For the format of the data that is stored, please refer to the `dt-init stateSaveCallback` documentation. The `dt-event stateLoadParams` event is fired at the same point as `dt-init stateLoadCallback` (technically the callback fires before the event, but they occur sequentially and thus either can be used to achieve the same effect). Please note that, as with all DataTables emitted events, this event is triggered with the `dt` namespace. As such, to listen for this event, you must also use the `dt` namespace by simply appending `.dt` to your event name, as shown in the example below. state() state.clear() state.loaded() state.save() stateSave stateSaveCallback stateLoadParams stateLoaded stateSaveParams stateLoaded stateSaveParams DataTablesSrc-1.10.11/docs/event/stateLoaded.xml000066400000000000000000000045171265711500300213620ustar00rootroot00000000000000 stateLoaded State loaded event - fired once state has been loaded and applied. 1.10 function( e, settings, json ) jQuery event object DataTables settings object State information read from storage HTML table element The `dt-event stateLoaded` event differs from the `dt-event stateLoadParams` in that it is fired after the state has been loaded and applied to the table (internally - the effects will not yet have been drawn onto the page upon execution of this event). This this case, the state object cannot be modified, while with `dt-event stateLoadParams` it can be. This event is usual for custom or plug-in parameters being loaded and applied from the state storage. The `dt-event stateLoaded` event is the event compliment of the `dt-init stateLoaded` callback initialisation option. The event is fired at the same time as the callback (technically the callback fires before the event, but they occur sequentially and thus either can be used to achieve the same effect). Please note that, as with all DataTables emitted events, this event is triggered with the `dt` namespace. As such, to listen for this event, you must also use the `dt` namespace by simply appending `.dt` to your event name, as shown in the example below. state() state.clear() state.loaded() state.save() stateSave stateSaveCallback stateLoadParams stateLoaded stateSaveParams stateLoadParams stateSaveParams DataTablesSrc-1.10.11/docs/event/stateSaveParams.xml000066400000000000000000000044741265711500300222360ustar00rootroot00000000000000 stateSaveParams State save event - fired when saving table state information. 1.10 function( e, settings, data ) jQuery event object DataTables settings object State information to be saved HTML table element The `dt-event stateSaveParams` event is the event compliment of the `dt-init stateSaveParams` initialisation option. As with the callback, the event is fired when the table has changed state a new state save is required. For the format of the data that is stored, please refer to the `dt-init stateSaveCallback` documentation. This event allows modification of the state saving object prior to actually doing the save, including addition or other state properties (for plug-ins) or modification of a DataTables core property. The `dt-event stateSaveParams` event is fired at the same point as `dt-init stateSaveCallback` (technically the callback fires before the event, but they occur sequentially and thus either can be used to achieve the same effect). Please note that, as with all DataTables emitted events, this event is triggered with the `dt` namespace. As such, to listen for this event, you must also use the `dt` namespace by simply appending `.dt` to your event name, as shown in the example below. state() state.clear() state.loaded() state.save() stateSave stateSaveCallback stateLoadParams stateLoaded stateSaveParams stateLoaded stateLoadParams DataTablesSrc-1.10.11/docs/event/xhr.xml000066400000000000000000000065711265711500300177340ustar00rootroot00000000000000 xhr Ajax event - fired when an Ajax request is completed 1.10 function( e, settings, json, xhr ) jQuery event object DataTables settings object Data returned from the server. This will be `-type null` if triggered by the Ajax error callback. [jQuery XHR](http://api.jquery.com/Types/#jqXHR) object that can be used to access the low level Ajax options. Since 1.10.7 you can return `true` to indicate to DataTables that it should not trigger its `dt-event error` event if you have handled an error condition yourself. HTML table element When working with Ajax data, it is often useful to know when DataTables has completed the loading of data, so you can either manipulate that data into the format DataTables expects based upon its configuration (`dt-init columns.data`) or so you can use the data contained in the JSON response from the server for other parts of the page. This event can be seen as the event compliment to the `dt-init ajax.dataSrc` option (which can also be used to manipulate and intercept the data from the Ajax request). Generally you would want to do data manipulation in the `dataSrc` callback and use events for intercepting the data. Note that this event is called before DataTables has processed the new data from the server, so the returned data will not have been drawn on page when this event fires. Additionally, as of DataTables 1.10.7 this event is triggered by both success and error conditions when the Ajax request completed (i.e. it is always triggered regardless of the outcome of the Ajax request). Prior to 1.10.7 it was only triggered by a successful request. The `json` parameter (3th passed in) for the event handler will be `null` if an error has occurred and the `xhr` parameter (4th) can be used to determine the error details if required. Please note that, as with all DataTables emitted events, this event is triggered with the `dt` namespace. As such, to listen for this event, you must also use the `dt` namespace by simply appending `.dt` to your event name, as shown in the example below. ajax ajax.json() ajax.url() ajax.reload() preXhr DataTablesSrc-1.10.11/docs/option/000077500000000000000000000000001265711500300165675ustar00rootroot00000000000000DataTablesSrc-1.10.11/docs/option/$.fn.dataTable.ext.errMode.xml000066400000000000000000000040461265711500300241150ustar00rootroot00000000000000 $.fn.dataTable.ext.errMode Set how DataTables will report detected errors 1.10 Perform one of the built in error reporting actions: * `-string alert` (default) - Alert the error * `-string throw` - Throw a Javascript error * `-string none` - Do nothing (you would want to use this `dt-event error` in this case) $.fn.dataTable.ext.errMode( settings, techNote, message ) DataTables settings object (`dt-type DataTables.Settings`). Technical note reference which contains detailed information about the error that has occured - this can be found at `https://datatables.net/tn/{techNote}`. Error message No return is excepted or acted upon. As a function you may provide your own error handling, for example showing a message to the end user or reloading the page to recover from an error situation. If DataTables encounters an error that it "knows about" (invalid JSON for example), it can provide useful information that describes the error and how to address it. The default error handling is intentionally obtrusive to let developers know that there is an issue while they are writing code that interfaces with DataTables. However, this is not always what you might wish to have on your page and this static option provides the ability to control how errors are reported. dt-event error DataTablesSrc-1.10.11/docs/option/ajax.data.xml000066400000000000000000000111621265711500300211450ustar00rootroot00000000000000 ajax.data Add or modify data submitted to the server upon an Ajax request 1.10 As an object, the `dt-init ajax.data` option is used to extend the data object that DataTables constructs internally to submit to the server. This provides an easy method of adding additional, static, parameters to the data to be sent to the server. For dynamically calculated values, use `dt-init ajax.data` as a function (see below). ajax.data( data, settings ) Data that DataTables has constructed for the request. This will include server-side processing parameters if you are using the `dt-init serverSide` option. DataTables settings object (`dt-type DataTables.Settings`). If there is no return value from the function (i.e. `dt-type undefined`) then the original data object passed into the function by DataTables will be used for the request (the function may have manipulated its values). If an object is returned, then that object will be used as the data for the request. It will not be merged with the original data object constructed by DataTables before being sent. If a string is returned, this string it will be used in the Ajax request body rather than individual HTTP parameters being sent. This is particularly useful for sending JSON encoded data in the request body so the server can decode it directly, rather than individual HTTP parameters being sent. See example below for how to use `JSON.stringify()` to achieve this. As a function, the `dt-init ajax.data` option can be used to modify the data DataTables submits to the server upon an Ajax request, by manipulating the original data object DataTables constructs internally, or by replacing it completely. This provides the ability to submit additional information to the server upon an Ajax request, with the function being executed upon each Ajax request, allowing values to be dynamically calculated. For example, a value could be read from a text input field to act as an additional search option. When making an Ajax request to the server, DataTables will construct a data object internally, with the data it requires to be sent to the server for the request. What this data contains will depend upon the processing mode DataTables is operating in: * For client-side processing no additional data is submitted to the server * For server-side processing (`dt-init serverSide`) the draw request parameters are submitted - see the [server-side processing manual](//datatables.net/manual/server-side). The `dt-init ajax.data` option provides the ability to add additional data to the request, or to modify the data object being submitted if required. In principle it operates in exactly the same way as jQuery's `$.ajax.data` property, in that it can be given as an object with parameters and values to submit, but DataTables extends this by also providing it with the ability to be a function, to allow the data to be re-evaluated upon each Ajax request (see above). ajax ajax.json() ajax.reload() ajax.url() DataTablesSrc-1.10.11/docs/option/ajax.dataSrc.xml000066400000000000000000000064721265711500300216250ustar00rootroot00000000000000 ajax.dataSrc Data property or manipulation method for table data 1.10 As a string, `dataSrc` defines the property from the data source object (i.e. that returned by the Ajax request) to read. Note that if your Ajax source simply returns an array of data to display, rather than an object, set this parameter to be an empty string. Additionally you can use Javascript dotted object notation to get a data source for multiple levels of object / array nesting. ajax.dataSrc( data ) Data returned from the server for the Ajax request Array of data that DataTables is to use to draw the table As a function `dataSrc` provides the ability to manipulate the data returned from the server from one form into another. For example, if your data is split over multiple arrays you might combine it into a single array to return for processing and display by DataTables. In this form `dataSrc` can be used to transform any data source, such as non-JSON data (XML, YAML, etc) into the Javascript array that DataTables expects. The `dt-init ajax` option basically inherits all of the options made available by [jQuery.ajax](http://api.jquery.com/jQuery.ajax/), but we provide the extra option of `dataSrc` to provide the ability to alter what data DataTables will read from the JSON return from the server, or to manipulate the data from one form into another (be it JSON to another form of JSON, XML, YAML etc). This is done because the `success` option of `dt-init ajax` **should not** be altered - DataTables uses it internally to execute the table draw when the data load is complete. `dt-string data` property of the data source object (or `dt-string aaData` if `dt-string data` is not present for backwards compatibility). View message'; } return json.data; } } } ); ]]> ajax ajax.json() ajax.reload() ajax.url() DataTablesSrc-1.10.11/docs/option/ajax.xml000066400000000000000000000175061265711500300202450ustar00rootroot00000000000000 ajax Load data for the table's content from an Ajax source 1.10 In its simplest form, `dt-init ajax`, when given as a string will simply load the data from the given remote file. Note that DataTables expects the table data to be an array of items in the `data` parameter of the object (use the `dt-init ajax.dataSrc` option of `dt-init ajax` as an object, if your data is formatted differently): ```js { "data": [ // row 1 data source, // row 2 data source, // etc ] } ``` DataTables can use objects or arrays in almost any format as the data source for each row through use of the `dt-init columns.data` option. The default is to use an array data source. Simple example: ```js $('#example').dataTable( { "ajax": "data.json" } ); ``` As an object, the `dt-init ajax` object is passed to [jQuery.ajax](http://api.jquery.com/jQuery.ajax/) allowing fine control of the Ajax request. DataTables has a number of default parameters which you can override using this option. Please refer to the [jQuery documentation](http://api.jquery.com/jQuery.ajax/) for a full description of the options available, although the following parameters provide additional options in DataTables or require special consideration: * `data` (`dt-init ajax.data`) - As with jQuery, `data` can be provided as an object, but as an extension, it can also provided as a function to manipulate the data DataTables sends to the server. The function takes a single parameter, an object of parameters with the values that DataTables has readied for sending. An object may be returned which will use used as the data to send to the server (therefore, if you wish to use the DataTables set parameters, you must merge them in your function), or you can add the items to the object that was passed in and not return anything from the function. This supersedes `fnServerParams` from DataTables 1.9-. * `dataSrc` (`dt-init ajax.dataSrc`) - By default DataTables will look for the property `data` (or `aaData` for compatibility with DataTables 1.9-) when obtaining data from an Ajax source or for server-side processing - this parameter allows that property to be changed, through two different forms: * As a string - define the property from the object to read. Note that if your Ajax source simply returns an array of data to display, rather than an object, set this parameter to be an empty string. Additionally you can use Javascript dotted object notation to get a data source for multiple levels of object / array nesting. * As a function - As a function it takes a single parameter, the JSON returned from the server, which can be manipulated as required. The returned value from the function is what will be used by DataTables as the data source for the table. * This supersedes `sAjaxDataProp` from DataTables 1.9-. * `success` - Must _not_ be overridden as it is used internally in DataTables. To manipulate / transform the data returned by the server use `dt-init ajax.dataSrc` (above), or use `ajax` as a function (below). Simple example: ```js $('#example').dataTable( { "ajax": { "url": "data.json", "type": "POST" } } ); ``` ajax( data, callback, settings ) Data to send to the server Callback function that must be executed when the required data has been obtained. That data should be passed into the callback as the only parameter DataTables settings object HTML table element As a function, making the Ajax call is left up to yourself allowing complete control of the Ajax request. Indeed, if desired, a method other than Ajax could be used to obtain the required data, such as Web storage or a Firebase database. When the data has been obtained from the data source, the second parameter (`callback` here) should be called with a single parameter passed in - the data to use to draw the table. Simple example: ```js $('#example').dataTable( { "ajax": function (data, callback, settings) { callback( JSON.parse( localStorage.getItem('dataTablesData') ) ); } } ); ``` Note that as of DataTables 1.10.6 the `dt-event xhr` event will be triggered when a function is used for `dt-init ajax` (even if there is no Ajax request). Prior to 1.10.6 no event would have been triggered. DataTables can obtain the data that it is to display in the table body from a number of sources, including from an Ajax data source, using this initialisation parameter. As with other dynamic data sources, arrays or objects can be used for the data source for each row, with `dt-init columns.data` employed to read from specific object properties. The `ajax` property has three different modes of operation, depending on how it is defined. These are: * `string` - Set the URL from where the data should be loaded from. * `object` - Define properties for `jQuery.ajax`. * `function` - Custom data get function View message'; } return json; } } } ); ]]> serverSide ajax.data ajax.dataSrc ajax.json() ajax.reload() ajax.url() DataTablesSrc-1.10.11/docs/option/autoWidth.xml000066400000000000000000000014131265711500300212600ustar00rootroot00000000000000 autoWidth Feature control DataTables' smart column width handling 1.10 Enable or disable automatic column width calculation. This can be disabled as an optimisation (it takes a finite amount of time to calculate the widths) if the tables widths are passed in using `dt-init columns.width`. columns.width columns.adjust() column-sizing DataTablesSrc-1.10.11/docs/option/columnDefs.targets.xml000066400000000000000000000042101265711500300230550ustar00rootroot00000000000000 columnDefs.targets Assign a column definition to one or more columns. 1.10 The `dt-init columnDefs` option allows a column definition object to be defined and then assigned to one or more columns in a DataTable, regardless of the order of the column definitions array, or the order of the columns in the table. This `dt-init columnDefs.targets` option provides the information required by DataTables for which columns in the table the column definition object should be applied. It can be: * 0 or a positive integer - column index counting from the left * A negative integer - column index counting from the right * A string - class name will be matched on the TH for the column (without a leading `.`) * The string "_all" - all columns (i.e. assign a default) Additionally, `targets` can be either a single option from the list above, or an array of options (the different types can be mixed in the array if required). For example `targets: [ -1, -2 ]` would target the last and second last columns in the table. Please note that unlike all other column configuration options which can be applied to be `dt-init columns` and `dt-init columnDefs`, the `dt-init columnDefs.targets` option can only be used in `dt-init columnDefs`. columnDefs column() columns() DataTablesSrc-1.10.11/docs/option/columnDefs.xml000066400000000000000000000071711265711500300214160ustar00rootroot00000000000000 columnDefs Set column definition initialisation properties. 1.10 Very similar to `dt-init columns`, this parameter allows you to assign specific options to columns in the table, although in this case the column options defined can be applied to one or more columns. Additionally, not every column need be specified, unlike `dt-init columns`. This parameter is an array of column definition objects, where the options available exactly match those for `dt-init columns` (see below for list of options in the related links). In addition to the column property options, `dt-init columnDefs` requires a `targets` property to be set in each definition object (`dt-init columnDefs.targets`). This `targets` property tells DataTables which column(s) the definition should be applied to. It can be: * 0 or a positive integer - column index counting from the left * A negative integer - column index counting from the right * A string - class name will be matched on the TH for the column * The string `-string _all` - all columns (i.e. assign a default) Additionally, `targets` can be either a single option from the list above, or an array of options (the different types can be mixed in the array if required). For example `targets: [ -1, -2 ]` would target the last and second last columns in the table. ### Conflict resolution As `dt-init columnDefs` allows columns to be columns to be defined one or more times in different column definition objects (typically to define different aspects of the columns) conflicts can arise whereby a single property might be defined with different values for the same column. Likewise, this situation could also occur when `dt-init columns` is used at the same time. DataTables uses the following rules to resolve such conflicts: 1. A property defined in `dt-init columns` will _always_ take priority over any value for that property defined in `dt-init columnDefs`. 2. Properties which are higher in the `dt-init columnDefs` array will take priority over those below. Consider for example the following table: ```js var table = $('#myTable').DataTable( { columnDefs: [ { targets: [0, 1], visible: true}, { targets: '_all', visible: false } ] } ); ``` The first and second columns will be visible in the table while all others will be hidden. columnDefs.targets columns columns.cellType columns.className columns.contentPadding columns.createdCell columns.data columns.defaultContent columns.name columns.orderable columns.orderData columns.orderDataType columns.render columns.searchable columns.title columns.type columns.visible columns.width column() columns() DataTablesSrc-1.10.11/docs/option/columns.cellType.xml000066400000000000000000000015601265711500300225530ustar00rootroot00000000000000 columns.cellType Cell type to be created for a column 1.10 Change the cell type created for the column - either `tag TD` cells or `tag TH` cells. This can be useful as `tag TH` cells have semantic meaning in the table body, allowing them to act as a header for a row (you may wish to add `scope='row'` to the `tag TH` elements using `dt-init columns.createdCell` option). ajax columns.createdCell DataTablesSrc-1.10.11/docs/option/columns.className.xml000066400000000000000000000016321265711500300227000ustar00rootroot00000000000000 columns.className Class to assign to each cell in the column 1.10 Quite simply this option adds a class to each cell in a column, regardless of if the table source is from DOM, Javascript or Ajax. This can be useful for styling columns. DataTablesSrc-1.10.11/docs/option/columns.contentPadding.xml000066400000000000000000000023611265711500300237330ustar00rootroot00000000000000 columns.contentPadding Add padding to the text content used when calculating the optimal with for a table. 1.10 The first thing to say about this property is that generally you shouldn't need this! Having said that, it can be useful on rare occasions. When DataTables calculates the column widths to assign to each column, it finds the longest string in each column and then constructs a temporary table and reads the widths from that. The problem with this is that "mmm" is much wider then "iiii", but the latter is a longer string - thus the calculation can go wrong (doing it properly and putting it into an DOM object and measuring that is horribly slow!). Thus as a "work around" we provide this option. It will append its value to the text that is found to be the longest string for the column - i.e. padding. autoWidth DataTablesSrc-1.10.11/docs/option/columns.createdCell.xml000066400000000000000000000037511265711500300232050ustar00rootroot00000000000000 columns.createdCell Cell created callback to allow DOM manipulation 1.10 createdCell( cell, cellData, rowData, rowIndex, colIndex ) The `tag TD` node that has been created Cell data. If you use `dt-init columns.render` to modify the data, use `$(cell).html()` to get and modify the rendered data. The information given here is the original and unmodified data from the data source. Data source object / array for the whole row DataTables' internal index for the row DataTables' internal index for the column HTML table element This is a callback function that is executed whenever a cell is created (Ajax source, etc) or read from a DOM source. It can be used as a complement to `dt-init columns.render` allowing modification of the cell's DOM element (add background colour for example) when the element is created (cells may not be immediately created on table initialisation if `dt-init deferRender` is enabled, or if rows are dynamically added using the API (`dt-api rows.add()`). This is the counterpart callback for rows, which use the `dt-init createdRow` option. createdRow deferRender DataTablesSrc-1.10.11/docs/option/columns.data.xml000066400000000000000000000224171265711500300217070ustar00rootroot00000000000000 columns.data Set the data source for the column from the rows data object / array 1.10 Treated as an array index for the data source. This is the default that DataTables uses (incrementally increased for each column). Read and write an object property to and from the data source. There are three 'special' options that can be used in the string to alter how DataTables reads the data from the source object: * `.` - Dotted Javascript notation. Just as you use a `.` in Javascript to read from nested objects, so to can the options specified in `data`. For example: `browser.version` or `browser.name`. If your object parameter name contains a period, use `\\` to escape it - i.e. `first\\.name`. * `[]` - Array notation. DataTables can automatically combine data from and array source, joining the data with the characters provided between the two brackets. For example: `name[, ]` would provide a comma-space separated list from the source array. If no characters are provided between the brackets, the original array source is returned. * `()` - Function notation. Adding `()` to the end of a parameter will execute a function of the name given. For example: `browser()` for a simple function on the data source, `browser.version()` for a function in a nested property or even `browser().version` to get an object property if the function called returns an object. Note that function notation is recommended for use in `render` rather than `data` as it is much simpler to use as a renderer. Use the original data source for the row rather than plucking data directly from it. This action has effects on two other initialisation options: * `dt-init columns.defaultContent` - When null is given as the `data` option and `defaultContent` is specified for the column, the value defined by `defaultContent` will be used for the cell. * `dt-init columns.render` - When null is used for the `data` option and the `render` option is specified for the column, the whole data source for the row is used for the renderer. Use different data for the different data types requested by DataTables (`string filter`, `string display`, `string type` or `string sort`). The property names of the object is the data type the property refers to and the value can defined using an integer, string or function using the same rules as `dt-init columns.data` normally does. Note that an `string _` option _must_ be specified. This is the default value to use if you haven't specified a value for the data type requested by DataTables. As an example you might use: ```js "data": { "_": "phone", "filter": "phone_filter", "display": "phone_display" } ``` data( row, type, set, meta ) The data for the whole row The data type requested for the cell Value to set if the `type` parameter is `-string set`. Otherwise, `-type undefined`. An object that contains additional information about the cell being requested. This object contains the following properties: * `row` - The row index for the requested cell. See `dt-api row().index()`. * `col` - The column index for the requested cell. See `dt-api column().index()`. * `settings` - The `dt-type DataTables.Settings` object for the table in question. This can be used to obtain an API instance if required. The return value from the function is not required when 'set' is the type of call, but otherwise the return is what will be used for the data requested. The function given will be executed whenever DataTables needs to set or get the data for a cell in the column. This function might be called multiple times, as DataTables will call it for the different data types that it needs - sorting, filtering and display. Please note that DataTables will call the function as a _setter_ when a new row is added only when the row's data is read from the DOM (i.e. the table is initialised on a pre-populated HTML table). The function is not called as setter when the data is source from Javascript or Ajax under the assumption that the data is already in the format required. HTML table element Takes the index value of the column automatically 1.10.1 the function will be executed in the same scope as the data object for the row. The result of this is that an object instance can be used as the data source for a row. Note that `data` is both a getter and setter option. If you just require formatting of data for output, you will likely want to use `dt-init columns.render` which is simply a getter and thus much simpler to use! As of DataTables 1.10.3 this option can be used with a DOM sourced data to instruct DataTables where to write the data read for each column to in a data source object. By default DataTables will store the data in an array, but using this option you can provide object property names which describe the structure of the object to use ([example](/examples/advanced_init/object_dom_read.html)). ]]> columns.render DataTablesSrc-1.10.11/docs/option/columns.defaultContent.xml000066400000000000000000000040341265711500300237500ustar00rootroot00000000000000 columns.defaultContent Set default, static, content for a column 1.10 Often you may wish to have static content in a column, for example simple edit and / or delete buttons, which have events assigned to them. This option is available for those use cases - creating static content for a column. If you wish to create dynamic content (i.e. based on other data in the row), the `dt-init columns.render` option should be used. Additionally, this option can be useful when loading JSON data, as the value set here will be used if the cell value from the JSON is found to be null (for example, you might set a default string of `string Not available`. Not set" } ] } ); ]]> Edit", "targets": -1 } ] } ); ]]> Edit" } ] } ); ]]> columns.data columns.render DataTablesSrc-1.10.11/docs/option/columns.name.xml000066400000000000000000000034451265711500300217160ustar00rootroot00000000000000 columns.name Set a descriptive name for a column 1.10 When working with DataTables' API, it is very common to want to be able to address individual columns so you can work with them (you wish to sum the numeric content of a column for example). DataTables has two basic methods of addressing columns: * As a column index (automatically assigned when the table is initialised) * With a name - assigned using this option! This can make working with columns in the API very easy - for example to access the data from the column named `string location` you would use `table.column( 'location:name' ).data()` - append the string `-string :name` to indicate to DataTables that it should perform a column name selector operation. For more information about column selectors, please see the `dt-api column()` documentation. column() columns() column().index() columns().indexes() DataTablesSrc-1.10.11/docs/option/columns.orderData.xml000066400000000000000000000030521265711500300226750ustar00rootroot00000000000000 columns.orderData Define multiple column ordering as the default order for a column 1.10 A single column index to order upon Multiple column indexes to define multi-column sorting Takes the index value of the column automatically Allows a column's sorting to take multiple columns into account when doing a order. For example with first name / last name columns next to each other, it is intuitive that they would be linked together to multi-column sort. ordering order order() column().order() columns().order() DataTablesSrc-1.10.11/docs/option/columns.orderDataType.xml000066400000000000000000000034751265711500300235500ustar00rootroot00000000000000 columns.orderDataType Live DOM sorting type assignment 1.10 DataTables' primary order method (the `dt-init ordering` feature) makes use of data that has been cached in memory rather than reading the data directly from the DOM every time an order is performed for performance reasons (reading from the DOM is inherently slow). However, there are times when you do actually want to read directly from the DOM, acknowledging that there will be a performance hit, for example when you have form elements in the table and the end user can alter the values. This configuration option is provided to allow plug-ins to provide this capability in DataTables. Please note that there are no `dt-init columns.orderDataType` plug-ins built into DataTables, they must be added separately. See [the DataTables sorting plug-ins page](//datatables.net/plug-ins/sorting) for further information. ordering columns.type DataTablesSrc-1.10.11/docs/option/columns.orderSequence.xml000066400000000000000000000025051265711500300235760ustar00rootroot00000000000000 columns.orderSequence Order direction application sequence 1.10 You can control the default ordering direction, and even alter the behaviour of the order handler (i.e. only allow ascending sorting etc) using this parameter. ordering order order() column().order() columns().order() DataTablesSrc-1.10.11/docs/option/columns.orderable.xml000066400000000000000000000024461265711500300227350ustar00rootroot00000000000000 columns.orderable Enable or disable ordering on this column 1.10 Using this parameter, you can remove the end user's ability to order upon a column. This might be useful for generated content columns, for example if you have 'Edit' or 'Delete' buttons in the table. Note that this option only effects the end user's ability to order a column. Are are still able to order a column using the `dt-init order` option or the `dt-api order()` method if required. ordering order order() column().order() columns().order() DataTablesSrc-1.10.11/docs/option/columns.render.xml000066400000000000000000000237311265711500300222550ustar00rootroot00000000000000 columns.render Render (process) the data for use in the table 1.10 Treated as an array index for the data source. This is the default that DataTables uses (incrementally increased for each column). Read an object property from the data source. There are three 'special' options that can be used in the string to alter how DataTables reads the data from the source object: * `.` - Dotted Javascript notation. Just as you use a `.` in Javascript to read from nested objects, so you can use the options specified in `data`. For example: `browser.version` or `browser.name`. If your object parameter name contains a period, use `\\` to escape it - i.e. `first\\.name`. * `[]` - Array notation. DataTables can automatically combine data from an array source, joining the data with the characters provided between the two brackets. For example: `name[, ]` would provide a comma-space separated list from the source array. If no characters are provided between the brackets, the original array source is returned. See above for further information on array access. * `()` - Function notation. Adding `()` to the end of a parameter will execute a function of the name given. For example: `browser()` for a simple function on the data source, `browser.version()` for a function in a nested property or even `browser().version` to get an object property if the function called returns an object. Note that function notation is recommended for use in `dt-init columns.render` rather than `dt-init columns.data` as it is much simpler to use as a renderer. Use different data for the different data types requested by DataTables (`string filter`, `string display`, `string type` or `string sort`). The property names of the object is the data type the property refers to and the value can defined using an integer, string or function using the same rules as `dt-init columns.render` normally does. Note that an `string _` option can optionally be specified. This is the default value to use if you haven't specified a value for the data type requested by DataTables. If there is no option for the data type requested that the `string _` option has not been specified, the data pointed to by the `dt-init columns.data` option will be used. As an example you might use: ```js "data": "phone", "render": { "_": "plain", "filter": "filter", "display": "display" } ``` render( data, type, row, meta ) The data for the cell (based on `dt-init columns.data`) The type call data requested - this will be 'filter', 'display', 'type' or 'sort'. The full data source for the row (not based on `dt-init columns.data`) An object that contains additional information about the cell being requested. This object contains the following properties: * `row` - The row index for the requested cell. See `dt-api row().index()`. * `col` - The column index for the requested cell. See `dt-api column().index()`. * `settings` - The `dt-type DataTables.Settings` object for the table in question. This can be used to obtain an API instance if required. The return value from the function is what will be used for the data requested. If a function is given, it will be executed whenever DataTables needs to get the data for a cell in the column. Note that this function might be called multiple times, as DataTables will call it for the different data types that it needs - sorting, filtering and display. HTML table element 1.10.1 the function will be executed in the same scope as the data object for the row. The result of this is that an object instance can be used as the data source for a row. See the examples below for how to use an instance with DataTables. ### Array access When used as a string (see below), this option can be used to obtain multiple data points from an array or access specifically just one element in an array. It is important to understand the difference between the two forms if you wish to access array based data inside a row's data object. * Use one or more properties from an array - use `[]` notation * Obtain a single element from the array only - use dotted notation - e.g. `.0` to access the first element in the array. Consider for example this data structure: ```js "access": [ { "id": "1", "name": "Printer" }, { "id": "3", "name": "Desktop" }, { "id": "4", "name": "VMs" } ] ``` To display the `name` property from the objects in the array, in a single cell, use `access[, ].name` - this will concatenate the names separated by `, ` - e.g. in this case the result would be `-string Printer, Desktop, VMs`. To access a single property from an array use `.{index}`. Using the above JSON again, to display just the first name from the access array use `access.0.name` - e.g. in this case the result would be `Printer`. ]]> Download'; } } ] } ); ]]> 40 ? ''+data.substr( 0, 38 )+'...' : data; } } ] } ); ]]> columns.data DataTablesSrc-1.10.11/docs/option/columns.searchable.xml000066400000000000000000000021671265711500300230670ustar00rootroot00000000000000 columns.searchable Enable or disable filtering on the data in this column 1.10 Using this parameter, you can defined if DataTables should include this column in the filterable data in the table. You may want use this option to display filtering on generated columns such as 'Edit' and 'Delete' buttons for example. search search() column().search() columns().search() DataTablesSrc-1.10.11/docs/option/columns.title.xml000066400000000000000000000025771265711500300221240ustar00rootroot00000000000000 columns.title Set the column title 1.10 Value read from the column's header cell. The titles of columns are typically read directly from the DOM (from the cells in the `tag THEAD` element), but it can often be useful to either override existing values, or have DataTables actually construct a header with column titles for you (for example if there is not `tag THEAD` element in the table before DataTables is constructed). This option is available to provide that ability. Please note that when constructing a header, DataTables can only construct a simple header with a single cell for each column. Complex headers with `colspan` and `rowspan` attributes must either already be defined in the document, or be constructed using standard DOM / jQuery methods. DataTablesSrc-1.10.11/docs/option/columns.type.xml000066400000000000000000000073721265711500300217620ustar00rootroot00000000000000 columns.type Set the column type - used for filtering and sorting string processing 1.10 Auto-detected from raw data. When operating in client-side processing mode, DataTables can process the data used for the display in each cell in a manual suitable for the action being performed. For example, HTML tags will be removed from the strings used for filter matching, while sort formatting may remove currency symbols to allow currency values to be sorted numerically. The formatting action performed to _normalise_ the data so it can be ordered and searched depends upon the column's _type_. DataTables has a number of built in types which are automatically detected: * `date` - Date / time values. Note that DataTables' built in date parsing uses Javascript's `Date.parse()` method which supports only a [very limited subset of dates](http://blog.dygraphs.com/2012/03/javascript-and-dates-what-mess.html). Additional date format support can be added through the use of plug-ins. * Sorting - sorted chronologically * Filtering - no effect * `num` - Simple number sorting. * Sorting - sorted numerically * Filtering - no effect * `num-fmt` - Numeric sorting of formatted numbers. Numbers which are formatted with thousands separators, currency symbols or a percentage indicator will be sorted numerically automatically by DataTables. * Supported built-in currency symbols are `$`, `£`, `€` and `¥`. * Supported built-in thousands separators are `'` and `,`. * Examples: * $100,000 - sorted as `100000` * £10'000 - sorted as `10000` * 5'000 - sorted as 5000 * 40% - sorted as 40 * Sorting - sorted numerically * Filtering - no effect * `html-num` - As per the `num` option, but with HTML tags also in the data. * Sorting - sorted numerically * Filtering - HTML tags removed from filtering string * `html-num-fmt` - As per the `num-fmt` option, but with HTML tags also in the data. * Sorting - sorted numerically * Filtering - HTML tags removed from filtering string * `html` - Basic string processing for HTML tags * Sorting - sorted with HTML tags removed * Filtering - HTML tags removed from filtering string * `string` - Fall back type if the data in the column does not match the requirements for the other data types (above). * Sorting - no effect * Filtering - no effect It is expected that the above options will cover the majority of data types used with DataTables, however, data is flexible and comes in many forms, so additional types with different effects can be added through the use of plug-ins. This provides the ability to sort almost any data format imaginable! As an optimisation, if you know the column type in advance, you can set the value using this option, saving DataTables from running its auto detection routine. Please note that if you are using server-side processing (`dt-init serverSide`) this option has no effect since the ordering and search actions are performed by a server-side script. ordering searching DataTablesSrc-1.10.11/docs/option/columns.visible.xml000066400000000000000000000025311265711500300224260ustar00rootroot00000000000000 columns.visible Enable or disable the display of this column 1.10 DataTables and show and hide columns dynamically through use of this option and the `dt-api column().visible()` / `dt-api columns().visible()` methods. This option can be used to get the initial visibility state of the column, with the API methods used to alter that state at a later time. This can be particularly useful if your table holds a large number of columns and you wish the user to have the ability to control which columns they can see, or you have data in the table that the end user shouldn't see (for example a database ID column). scrollX column().visible() columns().visible() DataTablesSrc-1.10.11/docs/option/columns.width.xml000066400000000000000000000026371265711500300221170ustar00rootroot00000000000000 columns.width Column width assignment 1.10 Auto-detected from the table's content. This parameter can be used to define the width of a column, and may take any CSS value (3em, 20px etc). Please note that pixel perfect column width is virtually impossible to achieve in tables with dynamic content, so do not be surprised if the width of the column if off by a few pixels from what you assign using this property. Column width in tables depends upon many properties such as cell borders, table borders, the `border-collapse` property, the content of the table and many other properties. Both DataTables and the browsers attempt to lay the table out in an optimal manner taking this options all into account. autoWidth columns.adjust() DataTablesSrc-1.10.11/docs/option/columns.xml000066400000000000000000000034551265711500300210000ustar00rootroot00000000000000 columns Set column specific initialisation properties. 1.10 The `dt-init columns` option in the initialisation parameter allows you to define details about the way individual columns behave. For a full list of column options that can be set, please see the related parameters below. Note that if you use `dt-init columns` to define your columns, you _must_ have an entry in the array for every single column that you have in your table (these can be null if you don't which to specify any options). columnDefs columns.cellType columns.className columns.contentPadding columns.createdCell columns.data columns.defaultContent columns.name columns.orderable columns.orderData columns.orderDataType columns.render columns.searchable columns.title columns.type columns.visible columns.width column() columns() DataTablesSrc-1.10.11/docs/option/createdRow.xml000066400000000000000000000030641265711500300214130ustar00rootroot00000000000000 createdRow Callback for whenever a TR element is created for the table's body. 1.10 createdRow( row, data, dataIndex ) `tag TR` row element that has just been created Raw data source (array or object) for this row The index of the row in DataTables' internal storage. HTML table element This callback is executed when a `tag TR` element is created (and all `tag TD` child elements have been inserted), or registered if using a DOM source, allowing manipulation of the `tag TR` element. This is particularly useful when using deferred rendering (`dt-init deferRender`) or server-side processing (`dt-init serverSide`) so you can add events, class name information or otherwise format the row when it is created. data deferRender serverSide columns.createdCell DataTablesSrc-1.10.11/docs/option/data.xml000066400000000000000000000037271265711500300202330ustar00rootroot00000000000000 data Data to use as the display data for the table. 1.10 DataTables can obtain the data it is to display in the table's body from a number of sources, including being passed in as an array of row data using this initialisation parameter. As with other dynamic data sources, arrays or objects can be used for the data source for each row, with `dt-init columns.data` employed to read from specific object properties. Using this initialisation option can be useful when creating a table from a Javascript data source, or from a custom Ajax data get. Note that if `dt-init data` is specified, the data given in the array will replace any information that was found in the table's DOM when initialised. ajax columns.data row.add() rows.add() DataTablesSrc-1.10.11/docs/option/deferLoading.xml000066400000000000000000000050331265711500300216750ustar00rootroot00000000000000 deferLoading Delay the loading of server-side data until second draw 1.10 When given as an integer, this enables deferred loading, and instructs DataTables has to how many items are in the full data set. As an array, this also enables deferred loading, while the first data index tells DataTables how many rows are in the filtered result set, and the second how many in the full data set without filtering applied. When using server-side processing, the default mode of operation for DataTables is to simply throw away any data that currently exists in the table and make a request to the server to get the first page of data to display. This is fine for an empty table, but if you already have the first page of data displayed in the plain HTML, it is a waste of resources. As such, this option exists to allow you to instruct DataTables to not make that initial request, rather it will use the data already on the page (no sorting etc will be applied to it). `dt-init deferLoading` is used to indicate that deferred loading is required, but it is also used to tell DataTables how many records there are in the full table (allowing the information element and pagination to be displayed correctly). In the case where a filtering is applied to the table on initial load, this can be indicated by giving the parameter as an array, where the first element is the number of records available after filtering and the second element is the number of records without filtering (allowing the table information element to be shown correctly). Note that this option only has effect when `dt-init serverSide` is enabled. It does not have any effect when using client-side processing. ajax serverSide DataTablesSrc-1.10.11/docs/option/deferRender.xml000066400000000000000000000037061265711500300215440ustar00rootroot00000000000000 deferRender Feature control deferred rendering for additional speed of initialisation. 1.10 By default, when DataTables loads data from an Ajax or Javascript data source (`dt-init ajax` and `dt-init data` respectively) it will create all HTML elements needed up-front. When working with large data sets, this operation can take a not-insignificant amount of time, particularly in older browsers such as IE6-8. This option allows DataTables to create the nodes (rows and cells in the table body) only when they are needed for a draw. As an example to help illustrate this, if you load a data set with 10,000 rows, but a paging display length of only 10 records, rather than create all 10,000 rows, when deferred rendering is enabled, DataTables will create only 10. When the end user then sorts, pages or filters the data the rows needed for the next display will be created automatically. This effectively spreads the load of creating the rows across the life time of the page. Note that when enabled, it goes without saying that not all nodes will always be available in the table, so when working with API methods such as `dt-api columns().nodes()` you must take this into account. Below shows an example of how to use jQuery delegated events to handle such a situation. ajax data DataTablesSrc-1.10.11/docs/option/destroy.xml000066400000000000000000000023241265711500300210030ustar00rootroot00000000000000 destroy Destroy any existing table matching the selector and replace with the new options. 1.10 Initialise a new DataTable as usual, but if there is an existing DataTable which matches the selector, it will be destroyed and replaced with the new table. This can be useful if you want to change a property of the table which cannot be altered through the API. Note that if you are not changing the configuration of the table, but just altering the data displayed by the table, it is far more efficient to use the `dt-api ajax.reload()` method (or `dt-api rows.add()` etc). retrieve destroy ajax.reload() destroy DataTablesSrc-1.10.11/docs/option/displayStart.xml000066400000000000000000000015701265711500300217770ustar00rootroot00000000000000 displayStart Initial paging start point 1.10 Define the starting point for data display when using DataTables with pagination (`dt-init paging`). Note that this parameter is the number of records (counting from 0), rather than the page number, so if you have 10 records per page and want to start on the third page, it should be `20` rather than 2 or 3. lengthChange paging page() page.info() DataTablesSrc-1.10.11/docs/option/dom.xml000066400000000000000000000126211265711500300200720ustar00rootroot00000000000000 dom Define the table control elements to appear on the page and in what order 1.10 ` - div element * `<"class"` and `>` - div with a class * `<"#id"` and `>` - div with an ID ### Styling The styling libraries that DataTables supports will override the default value of the `dt-init dom` parameter and replace it with a value that is suitable for their layout system. For example the Bootstrap integration makes use of Bootstrap's grid layout. The defaults for the styling integrations are: Bootstrap: ```js "<'row'<'col-sm-6'l><'col-sm-6'f>>" + "<'row'<'col-sm-12'tr>>" + "<'row'<'col-sm-5'i><'col-sm-7'p>>", ``` Foundation: ```js "<'row'<'small-6 columns'l><'small-6 columns'f>r>"+ "t"+ "<'row'<'small-6 columns'i><'small-6 columns'p>>", ``` jQuery UI: ```js '<"fg-toolbar ui-toolbar ui-widget-header ui-helper-clearfix ui-corner-tl ui-corner-tr"lfr>'+ 't'+ '<"fg-toolbar ui-toolbar ui-widget-header ui-helper-clearfix ui-corner-bl ui-corner-br"ip>', ``` ### Plug-ins DataTables feature plug-ins can be developed to add additional features to DataTables and often will make use of this option, adding new letters to the DataTables core features. For example [TableTools](//datatables.net/extras/tabletools) adds the `T` option to `dt-init dom` to specify where table control buttons should be inserted into the table. Note, I am aware that this is the most complex option in DataTables and it takes a fair amount of understanding, particularly when using the styling integration options! The plan is to revamp this option in 1.11 to make it easier to use. ]]> {length} {processing} {table} {information} {pagination} */ $('#example').dataTable( { "dom": 'lrtip' } ); ]]> {filter} {length} {information} {pagination} {table} */ $('#example').dataTable( { "dom": '<"wrapper"flipt>' } ); ]]> {length} {filter}
    {table}
    {information} {pagination} */ $('#example').dataTable( { "dom": 'ip>' } ); ]]>
    {information} {processing} {table}
    {filter} {length} {pagination}
    */ $('#example').dataTable( { "dom": '<"top"i>rt<"bottom"flp><"clear">' } ); ]]>
    searching info ordering processing paging
    DataTablesSrc-1.10.11/docs/option/drawCallback.xml000066400000000000000000000026301265711500300216640ustar00rootroot00000000000000 drawCallback Function that is called every time DataTables performs a draw. 1.10 drawCallback( settings ) DataTables settings object HTML table element It can be useful to take an action on every draw event of the table - for example you might want to update an external control with the newly displayed data, or with server-side processing is enabled you might want to assign events to the newly created elements. This callback is designed for exactly that purpose and will execute on every draw. draw() draw DataTablesSrc-1.10.11/docs/option/footerCallback.xml000066400000000000000000000040271265711500300222270ustar00rootroot00000000000000 footerCallback Footer display callback function. 1.10 footerCallback( tfoot, data, start, end, display ) `-tag tfoot` element of the table's footer Full data array of the table. Note that this is in data index order. Use the `display` parameter for the current display order. Index for the current display starting point in the display array Index for the current display ending point in the display array Index array to translate the visual position to the full data array HTML table element Identical to `dt-init headerCallback` but for the table footer this function allows you to modify the table footer on every 'draw' event. Note that if the table does not have a `-tag tfoot` element, it this callback will not be fired. headerCallback drawCallback columns().footer() column().footer() DataTablesSrc-1.10.11/docs/option/formatNumber.xml000066400000000000000000000031621265711500300217540ustar00rootroot00000000000000 formatNumber Number formatting callback function. 1.10 formatNumber( toFormat ) Number to be formatted Formatted string for DataTables to show the number HTML table element Shows numbers grouped as thousands with a comma separator DataTables will display numbers in a few different locations when drawing information about a table, for example in the table's information element and the pagination controls. When working with large numbers it is often useful to format it for readability by separating the thousand units - for example 1 million is rendered as "1,000,000", allowing the user to see at a glance what order of magnitude the number shows. This function allows complete control over how that formatting is performed. By default DataTables will use the character specified in `dt-init language.thousands` (in turn, that, by default, is a comma) as the thousands separator. language.info language.thousands infoCallback DataTablesSrc-1.10.11/docs/option/headerCallback.xml000066400000000000000000000033311265711500300221560ustar00rootroot00000000000000 headerCallback Header display callback function. 1.10 headerCallback( thead, data, start, end, display ) `tag THEAD` element of the table's header Full data array of the table. Note that this is in data index order. Use the `display` parameter for the current display order. Index for the current display starting point in the display array Index for the current display ending point in the display array Index array to translate the visual position to the full data array HTML table element This function is called on every 'draw' event (i.e. when a filter, sort or page event is initiated by the end user or the API), and allows you to dynamically modify the header row. This can be used to calculate and display useful information about the table. footerCallback drawCallback columns().header() column().header() DataTablesSrc-1.10.11/docs/option/info.xml000066400000000000000000000016731265711500300202530ustar00rootroot00000000000000 info Feature control table information display field 1.10 When this option is enabled, Datatables will show information about the table including information about filtered data if that action is being performed. This option allows that feature to be enabled or disabled. Note that by default the information display is shown below the table on the left, but this can be controlled using `dt-init dom` and CSS). language.info language.infoEmpty language.infoFiltered infoCallback DataTablesSrc-1.10.11/docs/option/infoCallback.xml000066400000000000000000000043131265711500300216620ustar00rootroot00000000000000 infoCallback Table summary information display callback. 1.10 infoCallback( settings, start, end, max, total, pre ) DataTables settings object Starting position in data for the draw End position in data for the draw Total number of rows in the table (regardless of filtering) Total number of rows in the data set, after filtering The string that DataTables has formatted using its own rules The string to be displayed in the information element. HTML table element The information element can be used to convey information about the current state of the table. Although the internationalisation options presented by DataTables are quite capable of dealing with most customisations, there may be times where you wish to customise the string further. This callback allows you to do exactly that. Please note that if the `dt-init info` option id disable in the initialisation, this callback function is not fired. info language.info page.info() DataTablesSrc-1.10.11/docs/option/initComplete.xml000066400000000000000000000034601265711500300217500ustar00rootroot00000000000000 initComplete Initialisation complete callback. 1.10 initComplete( settings, json ) DataTables settings object JSON data retrieved from the server if the `ajax` option was set. Otherwise `undefined`. HTML table element It can often be useful to know when your table has fully been initialised, data loaded and drawn, particularly when using an `dt-init ajax` data source. In such a case, the table will complete its initial run before the data has been loaded (Ajax is asynchronous after all!) so this callback is provided to let you know when the data is fully loaded. Additionally the callback is passed in the JSON data received from the server when Ajax loading data, which can be useful for configuring components connected to your table, for example [Editor fields](//editor.datatables.net). Loading').appendTo('body); $('#example').dataTable( { "initComplete": function( settings, json ) { $('div.loading').remove(); } } ); ]]> ajax drawCallback init DataTablesSrc-1.10.11/docs/option/jQueryUI.xml000066400000000000000000000032141265711500300210260ustar00rootroot00000000000000 jQueryUI Use markup and classes for the table to be themed by jQuery UI ThemeRoller. 1.10 1.10 - To be removed in v1.11, where upon this functionality will be provided by a plug-in. See DataTables [styling options](//datatables.net/manual/styling/jqueryui) for more information. DataTables can be styled by a number of CSS library packages, included jQuery UI, Twitter Bootstrap and Foundation. Although Bootstrap, Foundation and other libraries require a plug-in, jQuery UI ThemeRoller support is built into DataTables and can be enabled simply with this parameter. When enabled, DataTables will use markup and classes created for jQuery UI ThemeRoller, making it very easy to integrate your tables with jQuery UI. When enabled, you will likely want to load the `jquery.dataTables_themeroller.css` file that is included in the DataTables package (`path media/css`) as ThemeRoller does not provide all of the styles needed by DataTables. Note that this feature is deprecated in DataTables 1.10 and will be removed in 1.11, where upon this feature will be provided by plug-ins, matching the other style libraries. Please see the [DataTables jQuery UI styling documentation](//datatables.net/manual/styling/jqueryui) for more information about the new method of styling the table using jQuery UI. DataTablesSrc-1.10.11/docs/option/language.aria.paginate.first.xml000066400000000000000000000021651265711500300247300ustar00rootroot00000000000000 language.aria.paginate.first WAI-ARIA label for the _first_ pagination button 1.10.10 There is no default value for this option as the `dt-init language.paginate.first` option contains a string by default. Set the ARIA label attribute for the _first_ pagination button. This can be particularly useful for cases where you wish to show an icon such as `«` in the button itself, while retaining full accessibility. language.aria.paginate language.paginate.first DataTablesSrc-1.10.11/docs/option/language.aria.paginate.last.xml000066400000000000000000000021601265711500300245370ustar00rootroot00000000000000 language.aria.paginate.last WAI-ARIA label for the _last_ pagination button 1.10.10 There is no default value for this option as the `dt-init language.paginate.last` option contains a string by default. Set the ARIA label attribute for the _last_ pagination button. This can be particularly useful for cases where you wish to show an icon such as `»` in the button itself, while retaining full accessibility. language.aria.paginate language.paginate.last DataTablesSrc-1.10.11/docs/option/language.aria.paginate.next.xml000066400000000000000000000020201265711500300245450ustar00rootroot00000000000000 language.aria.paginate.next WAI-ARIA label for the _next_ pagination button 1.10.10 There is no default value for this option as the `dt-init language.paginate.next` option contains a string by default. Set the ARIA label attribute for the _next_ pagination button. This can be particularly useful for cases where you wish to show an icon such as `»` or `›` in the button itself, while retaining full accessibility. language.aria.paginate language.paginate.next DataTablesSrc-1.10.11/docs/option/language.aria.paginate.previous.xml000066400000000000000000000020441265711500300254510ustar00rootroot00000000000000 language.aria.paginate.previous WAI-ARIA label for the _previous_ pagination button 1.10.10 There is no default value for this option as the `dt-init language.paginate.previous` option contains a string by default. Set the ARIA label attribute for the _previous_ pagination button. This can be particularly useful for cases where you wish to show an icon such as `«` or `‹` in the button itself, while retaining full accessibility. language.aria.paginate language.paginate.previous DataTablesSrc-1.10.11/docs/option/language.aria.paginate.xml000066400000000000000000000027531265711500300236050ustar00rootroot00000000000000 language.aria.paginate WAI-ARIA labels for pagination buttons 1.10.10 This object contains the properties that can be used for the ARIA label attributes that are applied to the pagination controls in DataTables. This can be useful when you use the `dt-init language.paginate` options to alter the default pagination button text to show icons rather than text, as the ARIA label attributes ensure that accessibility will still be retained. Please note that as the DataTables `dt-init language.paginate` options contain plain text, there is no need for ARIA label attributes, thus this object does not contain any default strings. language language.aria.paginate.next language.aria.paginate.previous language.aria.paginate.first language.aria.paginate.last DataTablesSrc-1.10.11/docs/option/language.aria.sortAscending.xml000066400000000000000000000016031265711500300246110ustar00rootroot00000000000000 language.aria.sortAscending Language strings used for WAI-ARIA specific attributes 1.10 ARIA label that is added to the table headers when the column may be sorted ascending by activating the column (click or return when focused). Note that the column header text is prefixed to this string. language language.aria language.aria.sortDescending DataTablesSrc-1.10.11/docs/option/language.aria.sortDescending.xml000066400000000000000000000016101265711500300247570ustar00rootroot00000000000000 language.aria.sortDescending Language strings used for WAI-ARIA specific attributes 1.10 ARIA label that is added to the table headers when the column may be sorted descending by activing the column (click or return when focused). Note that the column header text is prefixed to this string. language language.aria language.aria.sortAscending DataTablesSrc-1.10.11/docs/option/language.aria.xml000066400000000000000000000011471265711500300220120ustar00rootroot00000000000000 language.aria Language strings used for WAI-ARIA specific attributes 1.10 Strings that are used for WAI-ARIA labels and controls only (these are not actually visible on the page, but will be read by screen readers, and thus must be internationalised as well). language language.aria.sortAscending language.aria.sortDescending DataTablesSrc-1.10.11/docs/option/language.decimal.xml000066400000000000000000000043621265711500300224760ustar00rootroot00000000000000 language.decimal Decimal place character 1.10 An empty string value, as is the default here, causes DataTables to use a dot (`.`) as the decimal point. ⎖) or a dash (`-`) are often used to show the decimal place in a displayed number. When reading such numbers, Javascript won't automatically recognise them as numbers, however, DataTables' type detection and sorting methods can be instructed through the `dt-init language.decimal` option which character is used as the decimal place in your numbers. This will be used to correctly adjust DataTables' type detection and sorting algorithms to sort numbers in your table. This option is a little unusual as DataTables will never display a formatted, floating point number (it has no need to!) so this option only effects how it parses the read data (none of the other language options have this ability). Any character can be set as the decimal place using this option, although the decimal place used in a single table must be consistent (i.e. numbers with a dot decimal place and comma decimal place cannot both appear in the same table as the two types are ambiguous). Different tables on the same page can use different decimal characters if required. When given as an empty string (as this parameter is by default) a dot (`.`) is assumed to be the character used for the decimal place. ]]> language language.thousands DataTablesSrc-1.10.11/docs/option/language.emptyTable.xml000066400000000000000000000016601265711500300232040ustar00rootroot00000000000000 language.emptyTable Table has no records string 1.10 This string is shown in preference to `dt-init language.zeroRecords` when the table is empty of data (regardless of filtering) - i.e. there are zero records in the table. Note that this is an optional parameter. If it is not given, the value of `dt-init language.zeroRecords` will be used instead (either the default or given value). language language.infoEmpty language.zeroRecords DataTablesSrc-1.10.11/docs/option/language.info.xml000066400000000000000000000026131265711500300220300ustar00rootroot00000000000000 language.info Table summary information display string 1.10 This string gives information to the end user about the information that is current on display on the page. The following tokens can be used in the string and will be dynamically replaced as the table display updates. These tokens can be placed anywhere in the string, or removed as needed by the language requires: * `\_START\_` - Display index of the first record on the current page * `\_END\_` - Display index of the last record on the current page * `\_TOTAL\_` - Number of records in the table after filtering * `\_MAX\_` - Number of records in the table without filtering * `\_PAGE\_` - Current page number * `\_PAGES\_` - Total number of pages of data in the table language language.infoEmpty language.infoFiltered language.infoPostFix language.thousands DataTablesSrc-1.10.11/docs/option/language.infoEmpty.xml000066400000000000000000000015221265711500300230450ustar00rootroot00000000000000 language.infoEmpty Table summary information string used when the table is empty or records 1.10 Display information string for when the table is empty. Typically the format of this string should match `info`. language language.info language.infoFiltered language.infoPostFix language.thousands DataTablesSrc-1.10.11/docs/option/language.infoFiltered.xml000066400000000000000000000020361265711500300235060ustar00rootroot00000000000000 language.infoFiltered Appended string to the summary information when the table is filtered 1.10 When a user filters the information in a table, this string is appended to the information (`info`) to give an idea of how strong the filtering is. The token `_MAX_` is dynamically updated - see `dt-init language.info` for information about all available tokens. language language.info language.infoEmpty language.infoPostFix language.thousands DataTablesSrc-1.10.11/docs/option/language.infoPostFix.xml000066400000000000000000000020771265711500300233510ustar00rootroot00000000000000 language.infoPostFix String to append to all other summary information strings 1.10 If can be useful to append extra information to the info string at times, and this variable does exactly that. This string will be appended to the `dt-init language.info` (`dt-init language.infoEmpty` and `dt-init language.infoFiltered` in whatever combination they are being used) at all times. language language.info language.infoEmpty language.infoFiltered language.thousands DataTablesSrc-1.10.11/docs/option/language.lengthMenu.xml000066400000000000000000000025711265711500300232060ustar00rootroot00000000000000 language.lengthMenu Page length options string 1.10 Detail the action that will be taken when the drop down menu for the pagination length option is changed. The token `string _MENU_` is replaced with a default select list of 10, 25, 50 and 100 (or any other value specified by `dt-init lengthMenu`), and can be replaced with a custom select list if required. '+ ''+ ''+ ''+ ''+ ''+ ''+ ' records' } } ); ]]> language lengthChange lengthMenu page.len() DataTablesSrc-1.10.11/docs/option/language.loadingRecords.xml000066400000000000000000000017301265711500300240330ustar00rootroot00000000000000 language.loadingRecords Loading information display string - shown when Ajax loading data 1.10 When using Ajax sourced data and during the first draw when DataTables is gathering the data, this message is shown in an empty row in the table to indicate to the end user the the data is being loaded. Note that this parameter is not used when loading data by server-side processing, just Ajax sourced data with client-side processing. ajax language language.zeroRecords DataTablesSrc-1.10.11/docs/option/language.paginate.first.xml000066400000000000000000000022271265711500300240140ustar00rootroot00000000000000 language.paginate.first Pagination 'first' button string 1.10 ` should be encoded as `<` and `>` respectively. ]]> language language.paginate language.paginate.last language.paginate.next language.paginate.previous language.aria.paginate language.aria.paginate.first DataTablesSrc-1.10.11/docs/option/language.paginate.last.xml000066400000000000000000000022221265711500300236230ustar00rootroot00000000000000 language.paginate.last Pagination 'last' button string 1.10 ` should be encoded as `<` and `>` respectively. ]]> language language.paginate language.paginate.first language.paginate.next language.paginate.previous language.aria.paginate language.aria.paginate.last DataTablesSrc-1.10.11/docs/option/language.paginate.next.xml000066400000000000000000000022121265711500300236350ustar00rootroot00000000000000 language.paginate.next Pagination 'next' button string 1.10 ` should be encoded as `<` and `>` respectively. ]]> language language.paginate language.paginate.first language.paginate.last language.paginate.previous language.aria.paginate language.aria.paginate.next DataTablesSrc-1.10.11/docs/option/language.paginate.previous.xml000066400000000000000000000022521265711500300245370ustar00rootroot00000000000000 language.paginate.previous Pagination 'previous' button string 1.10 ` should be encoded as `<` and `>` respectively. ]]> language language.paginate language.paginate.first language.paginate.next language.paginate.last language.aria.paginate language.aria.paginate.previous DataTablesSrc-1.10.11/docs/option/language.paginate.xml000066400000000000000000000011331265711500300226610ustar00rootroot00000000000000 language.paginate Pagination specific language strings 1.10 Pagination string used by DataTables for the built-in pagination control types. language language.paginate.first language.paginate.last language.paginate.next language.paginate.previous DataTablesSrc-1.10.11/docs/option/language.processing.xml000066400000000000000000000012201265711500300232420ustar00rootroot00000000000000 language.processing Processing indicator string 1.10 Text that is displayed when the table is processing a user action (usually a sort command or similar). language language.loadingRecords DataTablesSrc-1.10.11/docs/option/language.search.xml000066400000000000000000000021621265711500300223410ustar00rootroot00000000000000 language.search Search input string 1.10 Sets the string that is used for DataTables filtering input control. The token `string _INPUT_`, if used in the string, is replaced with the HTML text box for the filtering input allowing control over where it appears in the string. If `string _INPUT_` is not given then the input box is appended to the string automatically. language searching language.searchPlaceholder search() DataTablesSrc-1.10.11/docs/option/language.searchPlaceholder.xml000066400000000000000000000023631265711500300245070ustar00rootroot00000000000000 language.searchPlaceholder Search input element placeholder attribute 1.10.1 The default value for this parameter is an empty string, meaning that it will not be visible to the end user. HTML 5 introduces a [placeholder](https://developer.mozilla.org/en/docs/Web/HTML/Element/Input#attr-placeholder) attribute for `-tag input type="text"` elements to provide informational text for an input control when it has no value. This parameter can be used to set a value for the placeholder attribute in a DataTable's search input. language searching language.search search() DataTablesSrc-1.10.11/docs/option/language.thousands.xml000066400000000000000000000025331265711500300231060ustar00rootroot00000000000000 language.thousands Thousands separator 1.10 DataTables' built in number formatter (`dt-init formatNumber`) is used to format large numbers that are used in the table information. By default a comma is used, but this can be trivially changed to any other character you wish with this parameter, suitable for any locality, or set to an empty string if you do not which to have a thousands separator character. Please note that unlike the `dt-init language.decimal` option, the thousands separator option is used for output of information only (specifically the `dt-init info` option). Changing it does not effect how DataTables reads numeric data. language language.decimal language.info language.infoEmpty language.infoFiltered language.infoPostFix formatNumber DataTablesSrc-1.10.11/docs/option/language.url.xml000066400000000000000000000032131265711500300216740ustar00rootroot00000000000000 language.url Load language information from remote file 1.10 All of the language options DataTables provides can be stored in a file on the server, which DataTables will look up if this parameter is passed. The file must be a valid JSON file, and the object it contains has the same properties as the `dt-init language` object in the initialiser object. There are a wide range of translations readily available on this site, in the [internationalisation plug-ins](//datatables.net/plug-ins/i18n). Note that when this parameter is set, DataTables' initialisation will be asynchronous due to the Ajax data load. That is to say that the table will not be drawn until the Ajax request as completed. As such, any actions that require the table to have completed its initialisation should be placed into the `dt-init initComplete` callback. language initComplete DataTablesSrc-1.10.11/docs/option/language.xml000066400000000000000000000064011265711500300210750ustar00rootroot00000000000000 language Language configuration options for DataTables 1.10 All strings that DataTables uses in its user interface are defined in this object, allowing you to modified them individually or completely replace them all as required. This ensures that DataTables is fully internationalisable as strings for any language can be used. The default language options for DataTables are shown below for reference. Additionally there are a wide range of translations readily available on this site, in the [internationalisation plug-ins](//datatables.net/plug-ins/i18n). The following is the default object that DataTables uses for its language strings (for information about each individual parameter, please see its individual documentation document): ```js { "decimal": "", "emptyTable": "No data available in table", "info": "Showing _START_ to _END_ of _TOTAL_ entries", "infoEmpty": "Showing 0 to 0 of 0 entries", "infoFiltered": "(filtered from _MAX_ total entries)", "infoPostFix": "", "thousands": ",", "lengthMenu": "Show _MENU_ entries", "loadingRecords": "Loading...", "processing": "Processing...", "search": "Search:", "zeroRecords": "No matching records found", "paginate": { "first": "First", "last": "Last", "next": "Next", "previous": "Previous" }, "aria": { "sortAscending": ": activate to sort column ascending", "sortDescending": ": activate to sort column descending" } } ``` As of DataTables 1.10.7 the new `dt-api i18n()` method can be used by plug-in authors to access language information from the `dt-init language` object. As such the list of parameters available here is not exhaustive - please refer to the documentation for the plug-in if it makes use of the `dt-api i18n()` method for full information about the parameters it can use. language.decimal language.emptyTable language.info language.infoEmpty language.infoFiltered language.infoPostFix language.thousands language.lengthMenu language.loadingRecords language.processing language.search language.zeroRecords language.paginate language.paginate.first language.paginate.last language.paginate.next language.paginate.previous language.aria language.aria.sortAscending language.aria.sortDescending i18n() DataTablesSrc-1.10.11/docs/option/language.zeroRecords.xml000066400000000000000000000016661265711500300234050ustar00rootroot00000000000000 language.zeroRecords Table empty as a result of filtering string 1.10 Text shown inside the table records when the is no information to be displayed after filtering. Note that `dt-init language.emptyTable` is shown when there is simply no information in the table at all (regardless of filtering), while this parameter is used for when the table is empty due to filtering. language language.emptyTable search search() DataTablesSrc-1.10.11/docs/option/lengthChange.xml000066400000000000000000000030021265711500300216730ustar00rootroot00000000000000 lengthChange Feature control the end user's ability to change the paging display length of the table. 1.10 When pagination is enabled, this option will control the display an option for the end user to change number of records to be shown per page. The options shown in the list are controlled by the `dt-init lengthMenu` configuration option. Note that by default the control is shown at the top left of the table. That can be controlled using `dt-init dom` and CSS. If this option is disabled (`false`) the length change input control is removed - although the `dt-api page.len()` method can still be used if you wish to programmatically change the page size and `dt-init pageLength` can be used to specify the initial page length. Paging itself is not effected. Additionally, if pagination is disabled using the `dt-init paging` option, this option is automatically disabled since it has no relevance when the is no pagination. dom lengthMenu language.lengthMenu pageLength page.len() DataTablesSrc-1.10.11/docs/option/lengthMenu.xml000066400000000000000000000032621265711500300214220ustar00rootroot00000000000000 lengthMenu Change the options in the page length `select` list. 1.10 [ 10, 25, 50, 100 ] This parameter allows you to readily specify the entries in the length drop down `select` list that DataTables shows when pagination is enabled. It can be either: * 1D array of integer values which will be used for both the displayed option and the value to use for the display length, or * 2D array which will use the first inner array as the page length values and the second inner array as the displayed options. This is useful for language strings such as 'All'). The page length values must always be integer values `> 0`, with the sole exception of `-1`. When `-1` is used as a value this tells DataTables to disable pagination (i.e. display all rows). Note that the `dt-init pageLength` property will be automatically set to the first value given in this array, unless `dt-init pageLength` is also provided. paging lengthChange pageLength page() page.info() page.len() DataTablesSrc-1.10.11/docs/option/order.xml000066400000000000000000000030731265711500300204270ustar00rootroot00000000000000 order Initial order (sort) to apply to the table 1.10 If ordering is enabled (`dt-init ordering`), then DataTables will perform a first pass order during initialisation. Using this parameter you can define which column(s) the order is performed upon, and the ordering direction. The `dt-init order` must be an array of arrays, each inner array comprised of two elements: * Column index to order upon * Direction so order to apply (`-string asc` for ascending order or `-string desc` for descending order). This 2D array structure allows a multi-column order to be defined as the initial state should it be required. ordering orderFixed columns.orderable columns.orderData columns.orderSequence order() DataTablesSrc-1.10.11/docs/option/orderCellsTop.xml000066400000000000000000000024161265711500300220750ustar00rootroot00000000000000 orderCellsTop Control which cell the order event handler will be applied to in a column 1.10 false 1 2.1 2.2 ``` In this case, when `dt-init orderCellsTop` is `false` (default) the cells `string 1` and `string 2.2` will have the order event listener applied to them. If `dt-init orderCellsTop` is `true` then `string 1` and `string 2.1` will have the order event listeners applied to them. ]]> ordering order order() DataTablesSrc-1.10.11/docs/option/orderClasses.xml000066400000000000000000000025631265711500300217500ustar00rootroot00000000000000 orderClasses Highlight the columns being ordered in the table's body 1.10 true ordering order order() DataTablesSrc-1.10.11/docs/option/orderFixed.xml000066400000000000000000000056441265711500300214150ustar00rootroot00000000000000 orderFixed Ordering to always be applied to the table 1.10 Prefix ordering. When given as an array, the ordering specified by `dt-init orderFixed` will be applied as a prefix order. The format of the array is described above. Prefix and / or postfix ordering. When given as an object, the `pre` and / or `post` parameters can be used to specify prefix and / or postfix ordering, respectively. neither option is required, so you can specify the option that you need only. As with the simple array option, the format of the arrays used described above. The option works in tandem with the `dt-init order` option which provides an initial ordering state for the table which can then be modified by the user clicking on column headings, while the ordering specified by this option will always be applied to the table, regardless of user interaction. This fixed ordering can be applied before (`pre`) or after (`post`) the user's own ordering criteria using the two different forms of this option (array or object) described below. The values that are used to describe the ordering conditions for the table are given as two element arrays: * Column index to order upon * Direction so order to apply (`-string asc` for ascending order or `-string desc` for descending order). It is also possible to give a set of nested arrays (i.e. arrays in arrays) to allow multi-column ordering to be assigned. This option can be useful if you a column (visible or hidden) which must always be sorted upon first - a priority order or index column for example, or for grouping similar rows together. ordering order columns.orderable columns.orderData order() order.fixed() DataTablesSrc-1.10.11/docs/option/orderMulti.xml000066400000000000000000000026451265711500300214460ustar00rootroot00000000000000 orderMulti Multiple column ordering ability control. 1.10 true When ordering is enabled (`dt-init ordering`), by default DataTables allows users to sort multiple columns by shift clicking upon the header cell for each column. Although this can be quite useful for users, it can also increase the complexity of the order, potentiality increasing the processing time of ordering the data. Therefore, this option is provided to allow this shift-click multiple column ability. Note that disabling this ability does not impede your ability as a developer to do multiple column ordering using `dt-init columns.orderData`, `dt-init order` or `dt-api order()`, it just disallows the user from performing their own multi-column order. columns.orderData columns.orderable ordering order orderFixed order() column().order() columns().order() DataTablesSrc-1.10.11/docs/option/ordering.xml000066400000000000000000000024201265711500300211200ustar00rootroot00000000000000 ordering Feature control ordering (sorting) abilities in DataTables. 1.10 true Enable or disable ordering of columns - it is as simple as that! DataTables, by default, allows end users to click on the header cell for each column, ordering the table by the data in that column. The ability to order data can be disabled using this option. Note that the ability to add or remove sorting of individual columns can be disabled by the `dt-init columns.orderable` option for each column. This parameter is a global option - when disabled, there are no sorting actions applied by DataTables at all. columns.orderable order orderFixed orderMulti orderClasses order() column().order() columns().order() DataTablesSrc-1.10.11/docs/option/pageLength.xml000066400000000000000000000016351265711500300213740ustar00rootroot00000000000000 pageLength Change the initial page length (number of rows per page) 1.10 Number of rows to display on a single page when using pagination. If `dt-init lengthChange` is feature enabled (it is by default) then the end user will be able to override the value set here to a custom setting using a pop-up menu (see `dt-init lengthMenu`). lengthChange lengthMenu paging page() page.info() page.len() DataTablesSrc-1.10.11/docs/option/paging.xml000066400000000000000000000016701265711500300205620ustar00rootroot00000000000000 paging Enable or disable table pagination. 1.10 true DataTables can split the rows in tables into individual pages, which is an efficient method of showing a large number of records in a small space. The end user is provided with controls to request the display of different data as the navigate through the data. This feature is enabled by default, but if you wish to disable it, you may do so with this parameter. info lengthChange lengthMenu pagingType page() DataTablesSrc-1.10.11/docs/option/pagingType.xml000066400000000000000000000026021265711500300214200ustar00rootroot00000000000000 pagingType Pagination button display options 1.10 1.10.8) * `string simple` - 'Previous' and 'Next' buttons only * `string simple_numbers` - 'Previous' and 'Next' buttons, plus page numbers * `string full` - 'First', 'Previous', 'Next' and 'Last' buttons * `string full_numbers` - 'First', 'Previous', 'Next' and 'Last' buttons, plus page numbers Further methods can be added using plug-ins. ]]> dom paging page() DataTablesSrc-1.10.11/docs/option/preDrawCallback.xml000066400000000000000000000024171265711500300223360ustar00rootroot00000000000000 preDrawCallback Pre-draw callback. 1.10 preDrawCallback( settings ) DataTables settings object HTML table element The partner of the `dt-init drawCallback` callback, this function is called at the very start of each table draw. It can therefore be used to update or clean the display before each draw (for example removing events), and additionally can be used to cancel the draw by returning `false`. Any other return (including `undefined`) results in the full draw occurring. drawCallback DataTablesSrc-1.10.11/docs/option/processing.xml000066400000000000000000000012621265711500300214660ustar00rootroot00000000000000 processing Feature control the processing indicator. 1.10 false Enable or disable the display of a 'processing' indicator when the table is being processed (e.g. a sort). This is particularly useful for tables with large amounts of data where it can take a noticeable amount of time to sort the entries. language.processing DataTablesSrc-1.10.11/docs/option/renderer.xml000066400000000000000000000043461265711500300211260ustar00rootroot00000000000000 renderer Display component renderer types 1.10 Attempt to use renderers of this name for all available renderers. If a renderer is not found matching this name for the renderer type requested, the default renderer will be used. Specify specific renderers for the different renderer types. For a list of the available renderer types, please see the documentation below. DataTables adds some complex components to your HTML page, such as the pagination control. The business logic used to calculate information should be displayed (what buttons in the case of the pagination buttons) is core to DataTables and generally doesn't vary how the buttons are actually displayed does based on the styling requirements of the page. For example the pagination buttons might be displayed as `dt-tag li` elements in a `dt-tag ul` list, or simply as a collection of `dt-tag a` buttons. This ability to use different renderers, while maintaining the same core business logic, is fundamental to how DataTables provides integration options for CSS frameworks such as Bootstrap, Foundation and jQuery UI, customising the HTML it uses to fit the requirements of each framework. This parameter controls which renderers will be used. The value given will be used is such a renderer exists, otherwise the default renderer will be used. Additional renderers can be added by plug-ins. DataTables currently supports two different types of renderers: * `header` - header cell renderer * `pageButton` - pagination buttons This list will likely expand significantly in future versions of DataTables! pagingType DataTablesSrc-1.10.11/docs/option/retrieve.xml000066400000000000000000000023611265711500300211400ustar00rootroot00000000000000 retrieve Retrieve an existing DataTables instance 1.10 Retrieve the DataTables object for the given selector. Note that if the table has already been initialised, this parameter will cause DataTables to simply return the object that has already been set up - it will not take account of any changes you might have made to the initialisation object passed to DataTables (setting this parameter to true is an acknowledgement that you understand this!). The `dt-init destroy` option can be used to reinitialise a table with different options if required. destroy destroy() DataTablesSrc-1.10.11/docs/option/rowCallback.xml000066400000000000000000000027621265711500300215440ustar00rootroot00000000000000 rowCallback Row draw callback. 1.10 rowCallback( row, data, index ) `tag TR` element being inserted into the document. Data source for the row (array or object) DataTables' internal index for the row - see `dt-api row().index()`. HTML table element This callback allows you to 'post process' each row after it have been generated for each table draw, but _before_ it is rendered into the document. This means that the contents of the row might not have dimensions (`$().width()` for example) if it is not already in the document. This function might be used for setting the row class name or otherwise manipulating the row's `tag TR` element (although note that `dt-init createdRow can often be more efficient). A' ); } } } ); ]]> drawCallback createdRow DataTablesSrc-1.10.11/docs/option/rowId.xml000066400000000000000000000043011265711500300203730ustar00rootroot00000000000000 rowId Data property name that DataTables will use to set `-tag tr` element DOM IDs 1.10.8 It can often be useful to have a [`id` attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id) on each `-tag tr` element in a DataTable for row selection and data source identification, particularly when using events. DataTables will attempt to automatically read an id value from the data source for each row using the property defined by this option. By default it is `DT_RowId` but can be set to any other name. As with `dt-init columns.data` it can also read from a nested JSON data source by using Javascript dotted object notation (e.g. `DT_RowId: 'image.id'`). If no id value for the row is found, the `id` property will not be automatically set. Any row id values that are given in the data source should match the [HTML specification](http://www.w3.org/TR/html5/dom.html#the-id-attribute) for what values it can take: > The value must be unique amongst all the IDs in the element's home subtree and must contain at least one character. The value must not contain any space characters. You may also wish to consider the [CSS 2.1 specification of an identifier](http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier) which is more restrictive than HTML5's and will provide maximum compatibility with jQuery: > identifiers (including element names, classes, and IDs in selectors) can contain only the characters [a-zA-Z0-9] and ISO 10646 characters U+00A0 and higher, plus the hyphen (-) and the underscore (_); they cannot start with a digit, two hyphens, or a hyphen followed by a digit. Identifiers can also contain escaped characters and any ISO 10646 character as a numeric code. dt-init rowId dt-api row().id() dt-api rows().ids() DataTablesSrc-1.10.11/docs/option/scrollCollapse.xml000066400000000000000000000016731265711500300223010ustar00rootroot00000000000000 scrollCollapse Allow the table to reduce in height when a limited number of rows are shown. 1.10 false When vertical (y) scrolling is enabled through the use of the `dt-init scrollY` option, DataTables will force the height of the table's viewport to the given height at all times (useful for layout). However, this can look odd when filtering data down to a small data set, and the footer is left "floating" further down. This parameter (when enabled) will cause DataTables to collapse the table's viewport down when the result set will fit within the given Y height. scrollY DataTablesSrc-1.10.11/docs/option/scrollX.xml000066400000000000000000000020021265711500300207310ustar00rootroot00000000000000 scrollX Horizontal scrolling 1.10 * `false` - No horizontal scrolling * `true` - Enable horizontal scrolling in the table Enable horizontal scrolling. When a table is too wide to fit into a certain layout, or you have a large number of columns in the table, you can enable horizontal (x) scrolling to show the table in a viewport, which can be scrolled. This property can be `true` which will allow the table to scroll horizontally when needed (recommended), or any CSS unit, or a number (in which case it will be treated as a pixel measurement). scrollY scrollCollapse DataTablesSrc-1.10.11/docs/option/scrollY.xml000066400000000000000000000021201265711500300207330ustar00rootroot00000000000000 scrollY Vertical scrolling 1.10 Enable vertical scrolling. Vertical scrolling will constrain the DataTable to the given height, and enable scrolling for any data which overflows the current viewport. This can be used as an alternative to paging to display a lot of data in a small area (although paging and scrolling can both be enabled at the same time if desired). The value given here can be any CSS unit, or a number (in which case it will be treated as a pixel measurement) and is applied to the table body (i.e. it does not take into account the header or footer height directly). paging scrollX scrollCollapse DataTablesSrc-1.10.11/docs/option/search.caseInsensitive.xml000066400000000000000000000015471265711500300237200ustar00rootroot00000000000000 search.caseInsensitive Control case-sensitive filtering option. 1.10 true Flag to indicate if the filtering should be case insensitive or not. search searchCols search search.search search.regex search.smart search() columns().search() DataTablesSrc-1.10.11/docs/option/search.regex.xml000066400000000000000000000024741265711500300216760ustar00rootroot00000000000000 search.regex Enable / disable escaping of regular expression characters in the search term. 1.10 Regular expressions can be used to build fantastically complex filtering terms, but also it is perfectly valid for users to enter characters such as `string *` into the filter, so a decision needs to be made if you wish to escape regular expression special characters or not. This option controls that ability in DataTables. It is simply a flag to indicate if the search term should be interpreted as a regular expression (`true`) or not (`false`) and therefore and special regex characters escaped. search searchCols search search.search search.caseInsensitive search.smart search() columns().search() DataTablesSrc-1.10.11/docs/option/search.search.xml000066400000000000000000000014521265711500300220240ustar00rootroot00000000000000 search.search Set an initial filtering condition on the table. 1.10 Search term that should be applied to the table. search searchCols search search.caseInsensitive search.regex search.smart search() columns().search() DataTablesSrc-1.10.11/docs/option/search.smart.xml000066400000000000000000000024761265711500300217140ustar00rootroot00000000000000 search.smart Enable / disable DataTables' smart filtering 1.10 DataTables' built-in filtering is "smart" in that it breaks the user's input into individual words and then matches those words in any position and in any order in the table (rather than simple doing a simple string compare). Although this can significantly enhance usability of the filtering feature, it uses a complex regular expression to perform this task, and as such it can interfere with a custom regular expression input if you enable that option (`dt-init search.regex`). As such, this option is provided to disable this smart filtering ability. search searchCols search search.search search.caseInsensitive search.regex search() columns().search() DataTablesSrc-1.10.11/docs/option/search.xml000066400000000000000000000024651265711500300205650ustar00rootroot00000000000000 search Set an initial filter in DataTables and / or filtering options. 1.10 The `dt-init search` option allows the way DataTables performs filtering to be set during the initialisation, and to set an initial global filter. The options that control how the filtering is performs are: * `dt-init search.caseInsensitive` - Indicate is case-insensitive sorting should be performed. * `dt-init search.regex` - Treat the search as a regular expression or not * `dt-init search.smart` - Use DataTables' smart filtering or not Additionally, to set an initial filter: * `dt-init search.search` - Set an initial global filter. search searchCols search.search search.caseInsensitive search.regex search.smart search() columns().search() DataTablesSrc-1.10.11/docs/option/searchCols.xml000066400000000000000000000022061265711500300213770ustar00rootroot00000000000000 searchCols Define an initial search for individual columns. 1.10 Basically the same as the `dt-init search` option, but in this case for individual columns, rather than the global filter, this option defined the filtering to apply to the table during initialisation. The array must be of the same size as the number of columns, and each element be an object with the parameters `search` and `escapeRegex` (the latter is optional). 'null' is also accepted and the default will be used. search search columns.searchable column().search() columns().search() DataTablesSrc-1.10.11/docs/option/searchDelay.xml000066400000000000000000000037751265711500300215510ustar00rootroot00000000000000 searchDelay Set a throttle frequency for searching 1.10.3 When given as `null` DataTables will automatically assign a value that is suitable for the processing mode that the DataTable is operating in: * Instant - client-side processing * 400mS - server-side processing The built in DataTables global search (by default at the top right of every DataTable)will instantly search the table on every keypress when in client-side processing mode and reduce the search call frequency automatically to 400mS when in server-side processing mode. This call frequency (throttling) can be controlled using the `dt-init searchDelay` parameter for both client-side and server-side processing. Being able to control the call frequency has a number of uses: * Older browsers and slower computers can have their processing load reduced by reducing the search frequency * Fewer table redraws while search can be less distracting for the user * Reduce the load on the server when using server-side processing by making fewer calls * Conversely, you can speed up the search when using server-side processing by reducing the default of 400mS to instant (`0`). As with many other parts of DataTables, it is up to yourself how you configure it to suit your needs! The value given for `dt-init searchDelay` is in milliseconds (mS). Please note that this option effects only the built in global search box that DataTables provides. It does not effect the `dt-api search()` or `dt-api column().search()` methods at all. If you wish to be able to throttle calls to those API methods use the utility method `dt-api $.fn.dataTable.util.throttle()`. search DataTablesSrc-1.10.11/docs/option/searching.xml000066400000000000000000000030771265711500300212630ustar00rootroot00000000000000 searching Feature control search (filtering) abilities 1.10 This option allows the search abilities of DataTables to be enabled or disabled. Searching in DataTables is "smart" in that it allows the end user to input multiple words (space separated) and will match a row containing those words, even if not in the order that was specified (this allow matching across multiple columns). Please be aware that technically the search in DataTables is actually a filter, since it is subtractive, removing data from the data set as the input becomes more complex. It is named "search" here, and else where in the DataTables API for consistency and to ensure there are no conflicts with other methods of a similar name (specific the `dt-api filter()` API method). Note that if you wish to use the search abilities of DataTables this must remain `true` - to remove the default search input box whilst retaining searching abilities (for example you might use the `dt-api search()` method), use the `dt-init dom` option. columns.searchable search searchCols search() column().search() DataTablesSrc-1.10.11/docs/option/serverSide.xml000066400000000000000000000031341265711500300214250ustar00rootroot00000000000000 serverSide Feature control DataTables' server-side processing mode. 1.10 false DataTables has two fundamental modes of operation: * Client-side processing - where filtering, paging and sorting calculations are all performed in the web-browser. * Server-side processing - where filtering, paging and sorting calculations are all performed by a server. By default DataTables operates in client-side processing mode, but can be switched to server-side processing mode using this option. Server-side processing is useful when working with large data sets (typically >50'000 records) as it means a database engine can be used to perform the sorting etc calculations - operations that modern database engines are highly optimised for, allowing use of DataTables with massive data sets (millions of rows). When operating in server-side processing mode, DataTables will send parameters to the server indicating what data it needs (what page, what filters are applied etc), and also expects certain parameters back in order that it has all the information required to display the table. The client-server communication protocol DataTables uses is [detailed in the DataTables documentation](//datatables.net/manual/server-side). ajax DataTablesSrc-1.10.11/docs/option/stateDuration.xml000066400000000000000000000027031265711500300221410ustar00rootroot00000000000000 stateDuration Saved state validity duration 1.10 Duration for which the saved state information is considered valid. After this period has elapsed the state will be returned to the default. This option is also used to indicate to DataTables if `localStorage` or `sessionStorage` should be used for storing the table's state. When set to `-1` `sessionStorage` will be used, while for 0 or greater `localStorage` will be used. The difference between the two storage APIs is that `sessionStorage` retains data only for the current session (i..e the current browser window). For more information on these two HTML APIs please refer to the [Mozilla Storage documentation](https://developer.mozilla.org/en-US/docs/Web/Guide/API/DOM/Storage). Please note that the value is given in seconds. The value `0` is a _special_ value as it indicates that the state can be stored and retrieved indefinitely with no time limit. stateSave DataTablesSrc-1.10.11/docs/option/stateLoadCallback.xml000066400000000000000000000043071265711500300226520ustar00rootroot00000000000000 stateLoadCallback Callback that defines where and how a saved state should be loaded. 1.10 stateLoadCallback( settings ) DataTables settings object Data retrieved from storage containing the saved state (from `dt-init stateSaveCallback`) HTML table element With this callback you can define where, and how, the state of a table is loaded from. By default DataTables will load from `localStorage` but you might wish to use a server-side database or cookies as your implementation requirements demand. For the format of the data that is stored, please refer to the `dt-init stateSaveCallback` documentation. Note that this callback works hand-in-hand with `dt-init stateSaveCallback`. This callback loads the state from storage when the table is reloaded while `dt-init stateSaveCallback` saves it. state() state.clear() state.loaded() state.save() stateSave stateSaveCallback stateLoadParams stateLoaded stateSaveParams stateLoaded stateLoadParams stateSaveParams DataTablesSrc-1.10.11/docs/option/stateLoadParams.xml000066400000000000000000000041301265711500300223730ustar00rootroot00000000000000 stateLoadParams State loaded - data manipulation callback 1.10 stateLoadParams( settings, data ) DataTables settings object Data to save. The data comes from `dt-init stateSaveParams` HTML table element Callback which allows modification of the saved state prior to loading that state. This callback is called when the table is loading state from the stored data, but prior to the settings object being modified by the saved state. Note that the `dt-init stateLoadCallback` option is used to define where and how to load the state, while this function is used to manipulate the data once it has been retrieved from storage. Further note that for plug-in authors, you should use the `dt-event stateLoadParams` event to load parameters for a plug-in. state() state.clear() state.loaded() state.save() stateSave stateSaveCallback stateLoaded stateLoadCallback stateSaveParams stateLoaded stateLoadParams stateSaveParams DataTablesSrc-1.10.11/docs/option/stateLoaded.xml000066400000000000000000000033331265711500300215440ustar00rootroot00000000000000 stateLoaded State loaded callback. 1.10 stateLoaded( settings, data ) DataTables settings object Data to save. The data comes from `dt-init stateSaveParams` HTML table element Callback that is fired once the state has been loaded (`dt-init stateLoadCallback`) and the saved data manipulated (if required - `dt-init stateLoadParams`). This callback is useful if you simply wish to know information from the saved state, without getting into the inner workings of where and how the state information has been saved. For example it can be useful for populating custom filter inputs. state() state.clear() state.loaded() state.save() stateSave stateSaveCallback stateLoadParams stateLoaded stateSaveParams stateLoadCallback stateLoadParams stateSaveParams DataTablesSrc-1.10.11/docs/option/stateSave.xml000066400000000000000000000050561265711500300212560ustar00rootroot00000000000000 stateSave State saving - restore table state on page reload 1.10 Enable or disable state saving. When enabled aDataTables will store state information such as pagination position, display length, filtering and sorting. When the end user reloads the page the table's state will be altered to match what they had previously set up. Data storage for the state information in the browser is performed by use of the `localStorage` or `sessionStorage` HTML5 APIs. The `dt-init stateDuration` indicated to DataTables which API should be used (`localStorage`: 0 or greater, or `sessionStorage`: -1). To be able to uniquely identify each table's state data, information is stored using a combination of the table's DOM `id` and the current page's pathname. If the table's `id` changes, or the page URL changes, the state information will be lost. Please note that the use of the HTML5 APIs for data storage means that the built in state saving option **will not work with IE6/7** as these browsers do not support these APIs. Alternative options of using cookies or saving the state on the server through Ajax can be used through the `dt-init stateSaveCallback` and `dt-init stateLoadCallback` options. state() state.clear() state.loaded() state.save() stateSaveCallback stateDuration stateLoadCallback stateLoadParams stateLoaded stateSaveParams stateLoaded stateLoadParams stateSaveParams DataTablesSrc-1.10.11/docs/option/stateSaveCallback.xml000066400000000000000000000066471265711500300227020ustar00rootroot00000000000000 stateSaveCallback Callback that defines how the table state is stored and where. 1.10 stateSaveCallback( settings, data ) DataTables settings object Data to save. The data comes from `dt-init stateSaveParams` HTML table element DataTables can save the state of the table (paging, filtering etc) when the `dt-init stateSave` option is enabled, and by default it will use HTML5's `localStorage` to save the state into. This callback method allows you to change where the state is saved (for example you might wish to use a server-side database or cookies). The data given to the function is an object which has the following structure: ```js { "time": {number} // Time stamp of when the object was created "start": {number} // Display start point "length": {number} // Page length "order": {array} // 2D array of column ordering information (see `order` option) "search": { "search": {string} // Search term "regex": {boolean} // Indicate if the search term should be treated as regex or not "smart": {boolean} // Flag to enable DataTables smart search "caseInsensitive": {boolean} // Case insensitive flag }, "columns" [ { "visible": {boolean} // Column visibility "search": {} // Object containing column search information. Same structure as `search` above } ] } ``` Note that additional extensions can add extra information to this structure, or you may use `dt-init stateSaveParams` or `dt-event stateSaveParams` to add your own parameters. Also the information stored is type sensitive - that is, the data type of the data given by DataTables must be preserved. For example the `start` parameter must be a `-type number` data type. This method is required only to store the data given to it. The `dt-init stateSaveParams` method is used to manipulate the data that is to actually be saved. This callback works hand-in-hand with `dt-init stateLoadCallback`. This method saves the state while `dt-init stateSaveCallback` will load it from where this callback has saved it. state() state.clear() state.loaded() state.save() stateSave stateLoadParams stateLoaded stateLoadCallback stateSaveParams stateLoaded stateLoadParams stateSaveParams DataTablesSrc-1.10.11/docs/option/stateSaveParams.xml000066400000000000000000000040151265711500300224140ustar00rootroot00000000000000 stateSaveParams State save - data manipulation callback 1.10 stateSaveParams( settings, data ) DataTables settings object Data to save. The data comes from `dt-init stateSaveParams` HTML table element Callback which allows modification of the parameters to be saved for the DataTables state saving (`dt-init stateSave`), prior to the data actually being saved. This callback is called every time DataTables requests that the state be saved. For the format of the data that is stored, please refer to the `dt-init stateSaveCallback` documentation. Note that the `dt-init stateSaveCallback` option is used to define where and how to store the state, while this function is used to manipulate the data before it is entered into storage. Further note that for plug-in authors, you should use the `dt-event stateSaveParams` event to add extra parameters to the state storage object if required. state() state.clear() state.loaded() state.save() stateSave stateSaveCallback stateLoadCallback stateLoadParams stateLoaded stateLoaded stateLoadParams stateSaveParams DataTablesSrc-1.10.11/docs/option/stripeClasses.xml000066400000000000000000000014131265711500300221340ustar00rootroot00000000000000 stripeClasses Set the zebra stripe class names for the rows in the table. 1.10 An array of CSS classes that should be applied to displayed rows, in sequence. This array may be of any length, and DataTables will apply each class sequentially, looping when required. Note that by default this option will take the values determined by the `$.fn.dataTable.ext.classes.stripe*` options (these are `string odd` and `string even` by default). DataTablesSrc-1.10.11/docs/option/tabIndex.xml000066400000000000000000000020441265711500300210470ustar00rootroot00000000000000 tabIndex Tab index control for keyboard navigation 1.10 By default DataTables allows keyboard navigation of the table (sorting, paging, and filtering) by adding a `tabindex` attribute to the required elements. This allows the end user to tab through the controls and press the enter key to activate them, allowing the table controls to be accessible without a mouse. The default tabindex is 0, meaning that the tab follows the flow of the document. You can overrule this using this parameter if you wish. Use a value of -1 to disable built-in keyboard navigation, although this is not recommended for accessibility reasons. ordering paging searching DataTablesSrc-1.10.11/docs/type/000077500000000000000000000000001265711500300162405ustar00rootroot00000000000000DataTablesSrc-1.10.11/docs/type/DataTables.Api.xml000066400000000000000000000053541265711500300215050ustar00rootroot00000000000000 DataTables.Api DataTables API object instance DataTablesSrc-1.10.11/docs/type/DataTables.Settings.xml000066400000000000000000000027531265711500300225740ustar00rootroot00000000000000 DataTables.Settings DataTables settings object DataTablesSrc-1.10.11/docs/type/array.xml000066400000000000000000000012331265711500300200770ustar00rootroot00000000000000 array Javascript `Array` type DataTablesSrc-1.10.11/docs/type/boolean.xml000066400000000000000000000013011265711500300203740ustar00rootroot00000000000000 boolean Javascript `Boolean` type DataTablesSrc-1.10.11/docs/type/cell-selector.xml000066400000000000000000000140331265711500300215200ustar00rootroot00000000000000 cell-selector Selector options for cells. Since: 1.10.11). This can be used by extensions such as FixedColumns and Responsive to allow easy column selection. * `dt-type function` - Function selector (Since: 1.10.3) * `dt-type jQuery` - jQuery object of cell nodes * `dt-type object` - DataTables cell indexes (`row` and `column` properties) * `dt-type array` - Array containing any combination of the above options ## No selector If no selector is given (more specifically `dt-type undefined`), then all cells are selected. ###### Get the nodes for all cells in the table: ```js var table = $('#example').DataTable(); var cells = table.cells().nodes(); ``` ## string When the selector is given as a string, it is treated as a [jQuery selector](http://api.jquery.com/category/selectors/) that operates on the `dt-tag td` and `dt-tag th` elements in the table's `dt-tag tbody`. For full information about the options available for jQuery selectors, please refer to the [jQuery selector documentation](http://api.jquery.com/category/selectors/). Note that just like jQuery selector, is it possible to supply multiple selectors using comma separated notation (i.e. just separate by a comma) when the selector is provided as a string. ###### Get data from a single cell by id: ```js var table = $('#example').DataTable(); var data = table.cell('#cell-2-42').data(); ``` ###### Select cells by class name: ```js var table = $('#example').DataTable(); var cells = table.cells('.priority'); ``` ###### Select cells by two class name selectors: ```js var table = $('#example').DataTable(); var cells = table.cells('.important, .intermediate'); ``` ## node `dt-tag td` and `dt-tag th` DOM elements can be given as a cell selector to select a cell in the DataTabels API from that DOM element. This can be useful for getting data from a cell directly, or performing other cell based operations, when you have only the DOM node for reference, for example in an event handler. ###### Get the data for a cell that was clicked upon: ```js var table = $('#example').DataTable(); $('#example tbody').on( 'click', 'td', function () { var cellData = table.cell( this ).data(); // ... do something with `cellData` } ); ``` ## Function < # Version requirement < < Using a function as a cell selector requires DataTables 1.10.3 or newer. For complete control over which cells are selected, it is possible to provide a function with logic you've defined to perform the selection. That logic can be as simple or as complex as you wish, performing the selection by simply returning `true` if the cell should be included in the selected results and `false` if not. That can be particularly useful for finding cells based on the data they contain, or based on properties of the cell node. The function receives three parameters: 1. Cell index - see `dt-api cell().index()` 2. Cell data - see `dt-api cell().data()`. Note that this is the original data for the cell, not the rendered data if you are using `dt-init columns.render` 3. Cell node - see `dt-api cell().node()`. Note that this may be `null` if you are using `dt-init deferRender`. The function is called once for every cell that can be selected, based on the `dt-type selector-modifier` options, which also defines the order of the cells for the called function. ###### Get the nodes for all cells that contain `1`: ```js var table = $('#example').DataTable(); var ones = table .cells( function ( idx, data, node ) { return data == 1 ? true : false; } ) .nodes(); // Add a class to the cells ones.to$().addClass('highlight'); ``` ## jQuery Very similar to the above `node` type (since a jQuery object is an _array-like_ list of DOM nodes), a jQuery instance can be given as a cell selector, with any nodes which are selected by jQuery and match those available in the table's `dt-tag tbody` selected. ###### Get data from cells in a jQuery instance: ```js var cells = $('td.immediate'); var table = $('#example').DataTable(); var cellData = table.cells( cells ).data(); ## Object Similar to the `dt-type row-selector` and `dt-type column-selector`, `dt-type cell-selector` can also use indexes to select individual cells, but in this case an object is used which has `row` and `column` properties, each of which is set to the row and column index, respectively, for the cell to be selected. Although not particularly useful as a primary selector method, this can be very useful for selecting individual cells based on a `dt-api cells()` call - see the example below. ###### Loop over all cells, adding a class if the data for the cell is greater than a given value. ```js table.cells().every( function () { if ( this.data() > 10 ) { $(this.node()).addClass( 'important' ); } } ); ``` ## array Any combination of the above options can be given as selector together, providing a method to select multiple cells, or to mix selector types, by simply providing the selector options you want in an array. ###### Get the data for two cells, based on id: ```js var table = $('#example').DataTable(); var data = table.cells( ['#cell-1-42', '#cell-1-91'] ).data(); ``` ###### Mix `cell-selector` types - id and class selector ```js var table = $('#example').DataTable(); var data = table.cells( ['#cell-1-42', '.important'] ).data(); ``` ]]> DataTablesSrc-1.10.11/docs/type/column-selector.xml000066400000000000000000000213331265711500300220770ustar00rootroot00000000000000 column-selector Selector options for columns. Since: 1.10.11) * Any element which has a `data-dt-column` attribute assigned to it, or a parent (Since: 1.10.11). This can be used by extensions such as FixedColumns and Responsive to allow easy column selection. * `dt-type function` - Function selector (Since: 1.10.3) * `dt-type jQuery` - jQuery object of the column header nodes * `dt-type array` - Array containing any combination of the above options ## No selector If no selector is given (more specifically `dt-type undefined`), then all columns are selected. ###### Get data for all columns in the table: ```js var table = $('#example').DataTable(); var allData = table.columns().data(); ``` ## integer DataTables stores each column internally with a column index for fast look up of column information. When the selector is given as an integer, this value represents a column data index (`dt-api columns().indexes()` / `dt-api column().index()`). Note that this is the column _data index_ and not the _visible index_. The _data index_ is fixed regardless of column visibility, while the _visible index_ will change as the visibility of columns are changed (see below for a visible index selector). ###### Column data index 0 data: ```js var table = $('#example').DataTable(); var data = table.column( 0 ).data(); ``` ## {integer}:visIdx The visible index of a column is the index when hidden columns are taken into account. This can be useful when working with event handlers and some columns are hidden, or can be hidden by the end user. This selector is simply a modification of the above `integer` type with the string `dt-string :visIdx` (or `dt-string :visible`) postfixed. For example: `3:visIdx`. ###### Get the data for a column that was clicked on: ```js var table = $('#example').DataTable( { columnDefs: [ { visible: false, targets: 1 } ] } ); $('#example tbody').on( 'click', 'td', function () { var columnData = table .column( $(this).index()+':visIdx' ) .data(); } ); ``` ## {string}:name DataTables provides the ability to assign a name to columns through the `dt-init columns.name` option, which can be very useful for giving columns a human readable representation. The `:name` selector provides the ability to selector columns based on the assigned name. This selector is simply a string (the column name) with `dt-string :name` postfixed. For example `salary:name`. Note that assigned column names need not be unique (although that you would normally wish them to be so). If a selector is given which matches multiple columns from the same name they will all be selected. ###### Get the data for a named column: ```js var table = $('#example').DataTable( { columns: [ { name: 'first-name' }, { name: 'last-name' }, { name: 'position' }, { name: 'location' }, { name: 'salary' } ] } ); // Get salary column data table.column( 'salary:name' ).data(); ``` ## string When the selector is given as a string, it is treated as a [jQuery selector](http://api.jquery.com/category/selectors/) that operates on the `dt-tag th` and `dt-tag td` elements of the column headers in the table. Each column has only one cell which is used as the column header - see `dt-init orderCellsTop` for information on how DataTables selected the cells to use for the column headers, if there is more than one possible cell for each column header in the table's `dt-tag thead` element. For full information about the options available for jQuery selectors, please refer to the [jQuery selector documentation](http://api.jquery.com/category/selectors/). Note that just like jQuery selector, is it possible to supply multiple selectors using comma separated notation (i.e. just separate by a comma) when the selector is provided as a string. ###### Select a single column by id: ```js var table = $('#example').DataTable(); var column = table.column('#column-3'); ``` ###### Select columns by class name: ```js var table = $('#example').DataTable(); var columns = table.columns('.priority'); ``` ###### Select column by contents: ```js var table = $('#example').DataTable(); var column = table.column(':contains(Salary)'); ``` ## node `dt-tag th` and `dt-tag td` DOM elements can be given as a column selector to select a column in the DataTabels API from that DOM element (as above, this selector applies to the cells which are used for the column headers, not necessarily all cells in the header if there are multiple rows). This can be useful for getting data from a column, or performing other column based operations, when you have only the DOM node for reference, for example in an event handler. ###### Get the data for a column that was clicked upon: ```js var table = $('#example').DataTable(); $('#example thead').on( 'click', 'th', function () { var columnData = table.column( this ).data(); // ... do something with `columnData` } ); ``` ## Function < # Version requirement < < Using a function as a column selector requires DataTables 1.10.3 or newer. For complete control over which columns are selected, it is possible to provide a function with logic you've defined to perform the selection. That logic can be as simple or as complex as you wish, performing the selection by simply returning `true` if the column should be included in the selected results and `false` if not. The function receives three parameters: 1. Column index - see `dt-api column().index()` 2. Column data - see `dt-api column().data()`. Note that this is an array of data with one entry for each cell in the selected column. The data uses is the original data for the cells, not the rendered data if you are using `dt-init columns.render` 3. Column node - see `dt-api column().header()`. Note that this is not the cells in the table body. Use `dt-api column().nodes()` if you require that information. The function is called once for every column that can be selected, based on the `dt-type selector-modifier` options, which also defines the order of the data passed in as the second argument for the called function. ###### Get the data for all columns that contain the string `Active`: ```js var table = $('#example').DataTable(); var active = table .columns( function ( idx, data, node ) { return $.inArray( 'Active', data ) !== -1 ? true : false; } ) .data(); ``` ## jQuery Very similar to the above `node` type (since a jQuery object is an _array-like_ list of DOM nodes), a jQuery instance can be given as a column selector, with any nodes which are selected by jQuery and match those available in the table's header cells. Please note that when working with a jQuery selected set of columns and hidden columns, jQuery itself will not select the column header cells which have been hidden (as DataTables removes them from the document when the column is hidden). To overcome this is problem, use the `string` option above which does not suffer from this issue and allows a jQuery selector to be used. ###### Get data from columns in a jQuery instance: ```js var columns = $('#example thead th.immediate'); var table = $('#example').DataTable(); var columnData = table.columns( columns ).data(); ``` ## array Any combination of the above options can be given as selector together, providing a method to select multiple columns, or to mix selector types, by simply providing the selector options you want in an array. ###### Get the data for two columns, based on column index: ```js var table = $('#example').DataTable(); var data = table.columns( [0, 1] ).data(); ``` ###### Mix `column-selector` types - index and class selector ```js var table = $('#example').DataTable(); var data = table.columns( [0, '.important'] ).data(); ``` ]]> DataTablesSrc-1.10.11/docs/type/function.xml000066400000000000000000000030061265711500300206060ustar00rootroot00000000000000 function Javascript `Function` DataTablesSrc-1.10.11/docs/type/integer.xml000066400000000000000000000021201265711500300204120ustar00rootroot00000000000000 integer Subset of the Javascript `Number` type using only integers DataTablesSrc-1.10.11/docs/type/jQuery.xml000066400000000000000000000016501265711500300202430ustar00rootroot00000000000000 jQuery jQuery object instance DataTablesSrc-1.10.11/docs/type/node.xml000066400000000000000000000020641265711500300177110ustar00rootroot00000000000000 node DOM element DataTablesSrc-1.10.11/docs/type/null.xml000066400000000000000000000015371265711500300177420ustar00rootroot00000000000000 null Javascript `null` type DataTablesSrc-1.10.11/docs/type/number.xml000066400000000000000000000014651265711500300202600ustar00rootroot00000000000000 number Javascript `Number` type DataTablesSrc-1.10.11/docs/type/object.xml000066400000000000000000000020401265711500300202240ustar00rootroot00000000000000 object Javascript `Object` type DataTablesSrc-1.10.11/docs/type/row-selector.xml000066400000000000000000000160571265711500300214200ustar00rootroot00000000000000 row-selector Selector options for rows. Since: 1.10.11) * Any element which has a `data-dt-row` attribute assigned to it, or a parent (Since: 1.10.11). This can be used by extensions such as FixedColumns and Responsive to allow easy row selection. * `dt-type function` - Function selector (Since: 1.10.3) * `dt-type jQuery` - jQuery object of row nodes * `dt-type array` - Array containing any combination of the above options ## No selector If no selector is given (more specifically `dt-type undefined`), then all rows are selected. ###### Get data for all rows in the table: ```js var table = $('#example').DataTable(); var allData = table.rows().data(); ``` ## integer DataTables stores each row internally with a row index for fast look up of row information. When the selector is given as an integer, this value represents a row index (`dt-api rows().indexes()` / `dt-api row().index()`). ###### Row index 0 data: ```js var table = $('#example').DataTable(); var data = table.row( 0 ).data(); ``` ###### Find data using row indexes: ```js var table = $('#example').DataTable(); // Find indexes of rows which have `Yes` in the second column var indexes = table.rows().eq( 0 ).filter( function (rowIdx) { return table.cell( rowIdx, 1 ).data() === 'Yes' ? true : false; } ); // Add a class to those rows using an index selector table.rows( indexes ) .nodes() .to$() .addClass( 'highlight' ); ``` ## string - #ID DataTables row selector is optimised for IDs as it is natural to wish to select rows by unique information. This is distinct from a jQuery selector as DataTables can optimise this selector type so as to not involve the DOM - also allowing an id row selector to operate on rows which have not yet had their DOM nodes created (when using `dt-init deferRender` for extra speed). With dynamically sourced data, the id assigned to the row is identifier using the `dt-init rowId` option. The data used as the id can be of any value, although it must be unique in the table. To use an id selector, simply prefix the id value for the row you wish to select with a number sign: `#`. The value that follows is taken as the id. Unlike jQuery this value does __not__ need to be escaped - although this means that an id selector must be used alone (e.g. a class name cannot also be used), it does make is much easier to use for complex data. ###### Select a single row by id: ```js var table = $('#example').DataTable(); var row = table.row('#row-42'); ``` ###### Select multiple rows by id: ```js var table = $('#example').DataTable(); var rows = table.rows( [ '#row-42', '#row-51' ] ); ``` ## string When the selector is given as a string, it is treated as a [jQuery selector](http://api.jquery.com/category/selectors/) that operates on the `dt-tag tr` elements in the table. For full information about the options available for jQuery selectors, please refer to the [jQuery selector documentation](http://api.jquery.com/category/selectors/). Note that just like jQuery selector, is it possible to supply multiple selectors using comma separated notation (i.e. just separate by a comma) when the selector is provided as a string. ###### Select rows by class name: ```js var table = $('#example').DataTable(); var rows = table.rows('.priority'); ``` ###### Select rows by two class name selectors: ```js var table = $('#example').DataTable(); var rows = table.rows('.important, .intermediate'); ``` ## node `dt-tag tr` DOM elements can be given as a row selector to select a row in the DataTabels API from that DOM element. This can be useful for getting data from a row, or performing other row based operations, when you have only the DOM node for reference, for example in an event handler. ###### Get the data for a row that was clicked upon: ```js var table = $('#example').DataTable(); $('#example tbody').on( 'click', 'tr', function () { var rowData = table.row( this ).data(); // ... do something with `rowData` } ); ``` ## Function < # Version requirement < < Using a function as a row selector requires DataTables 1.10.3 or newer. For complete control over which rows are selected, it is possible to provide a function with logic you've defined to perform the selection. That logic can be as simple or as complex as you wish, performing the selection by simply returning `true` if the row should be included in the selected results and `false` if not. That can be particularly useful for finding rows based on the data contained in the rows, or based on properties of the nodes. The function receives three parameters: 1. Row index - see `dt-api row().index()` 2. Row data - see `dt-api row().data()`. Note that this is the original data object for the row, not the rendered data if you are using `dt-init columns.render` 3. Row node - see `dt-api row().node()`. Note that this may be `null` if you are using `dt-init deferRender`. The function is called once for every row that can be selected, based on the `dt-type selector-modifier` options, which also defines the order of the rows for the called function. ###### Get the data all rows that have a `first_name` starting with `A`: ```js var table = $('#example').DataTable(); var names = table .rows( function ( idx, data, node ) { return data.first_name.charAt(0) === 'A' ? true : false; } ) .data(); ``` ## jQuery Very similar to the above `node` type (since a jQuery object is an _array-like_ list of DOM nodes), a jQuery instance can be given as a row selector, with any nodes which are selected by jQuery and match those available in the table selected. ###### Get data from rows in a jQuery instance: ```js var rows = $('tr.immediate'); var table = $('#example').DataTable(); var rowData = table.rows( rows ).data(); ``` ## array Any combination of the above options can be given as selector together, providing a method to select multiple rows, or to mix selector types, by simply providing the selector options you want in an array. ###### Get the data for two rows, based on id: ```js var table = $('#example').DataTable(); var data = table.rows( ['#row-42', '#row-91'] ).data(); ``` ###### Mix `row-selector` types - id and class selector ```js var table = $('#example').DataTable(); var data = table.rows( ['#row-42', '.important'] ).data(); ``` ]]> DataTablesSrc-1.10.11/docs/type/selector-modifier.xml000066400000000000000000000154551265711500300224100ustar00rootroot00000000000000 selector-modifier Options for how the row, column and cell selector should operate on rows. DataTablesSrc-1.10.11/docs/type/string.xml000066400000000000000000000012111265711500300202630ustar00rootroot00000000000000 string Javascript `String` type DataTablesSrc-1.10.11/docs/type/table-selector.xml000066400000000000000000000111271265711500300216710ustar00rootroot00000000000000 table-selector Selector options for tables. DataTablesSrc-1.10.11/docs/type/undefined.xml000066400000000000000000000015561265711500300207320ustar00rootroot00000000000000 undefined Javascript `undefined` type DataTablesSrc-1.10.11/images/000077500000000000000000000000001265711500300155745ustar00rootroot00000000000000DataTablesSrc-1.10.11/images/Sorting icons.psd000066400000000000000000000655421265711500300210410ustar00rootroot000000000000008BPSY:8BIM%8BIM$9K application/vnd.adobe.photoshop Adobe Photoshop CS2 Windows 2010-01-17T08:43:39Z 2010-01-17T09:53:06Z 2010-01-17T09:53:06Z uuid:220CFA684403DF11A9A8BDB603A4D90D uuid:C7B5E33A4603DF11A9A8BDB603A4D90D 1 720090/10000 720090/10000 2 256,257,258,259,262,274,277,284,530,531,282,283,296,301,318,319,529,532,306,270,271,272,305,315,33432;B41D6D118D265E2E28AF557E99C071A1 19 19 1 36864,40960,40961,37121,37122,40962,40963,37510,40964,36867,36868,33434,33437,34850,34852,34855,34856,37377,37378,37379,37380,37381,37382,37383,37384,37385,37386,37396,41483,41484,41486,41487,41488,41492,41493,41495,41728,41729,41730,41985,41986,41987,41988,41989,41990,41991,41992,41993,41994,41995,41996,42016,0,2,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,20,22,23,24,25,26,27,28,30;7A673769D20BEC7273BEFB09FBCCF7C5 3 sRGB IEC61966-2.1 8BIMHNHN8BIM&?8BIM Transparency8BIM Transparency8BIMd8BIM8BIM x8BIM8BIM 8BIM 8BIM' 8BIMH/fflff/ff2Z5-8BIMp8BIM8BIM 8BIM08BIM-8BIM@@8BIM8BIMnullbaseNameTEXTUserboundsObjcRct1Top longLeftlongBtomlongRghtlongslicesVlLsObjcslicesliceIDlonggroupIDlongoriginenum ESliceOrigin autoGeneratedTypeenum ESliceTypeImg boundsObjcRct1Top longLeftlongBtomlongRghtlongurlTEXTnullTEXTMsgeTEXTaltTagTEXTcellTextIsHTMLboolcellTextTEXT horzAlignenumESliceHorzAligndefault vertAlignenumESliceVertAligndefault bgColorTypeenumESliceBGColorTypeNone topOutsetlong leftOutsetlong bottomOutsetlong rightOutsetlong8BIM( ?8BIM H HLinomntrRGB XYZ  1acspMSFTIEC sRGB-HP cprtP3desclwtptbkptrXYZgXYZ,bXYZ@dmndTpdmddvuedLview$lumimeas $tech0 rTRC< gTRC< bTRC< textCopyright (c) 1998 Hewlett-Packard CompanydescsRGB IEC61966-2.1sRGB IEC61966-2.1XYZ QXYZ XYZ o8XYZ bXYZ $descIEC http://www.iec.chIEC http://www.iec.chdesc.IEC 61966-2.1 Default RGB colour space - sRGB.IEC 61966-2.1 Default RGB colour space - sRGBdesc,Reference Viewing Condition in IEC61966-2.1,Reference Viewing Condition in IEC61966-2.1view_. \XYZ L VPWmeassig CRT curv #(-27;@EJOTY^chmrw| %+28>ELRY`gnu| &/8AKT]gqz !-8COZfr~ -;HUcq~ +:IXgw'7HYj{+=Oat 2FZn  % : O d y  ' = T j " 9 Q i  * C \ u & @ Z t .Id %A^z &Ca~1Om&Ed#Cc'Ij4Vx&IlAe@e Ek*Qw;c*R{Gp@j>i  A l !!H!u!!!"'"U"""# #8#f###$$M$|$$% %8%h%%%&'&W&&&''I'z''( (?(q(())8)k))**5*h**++6+i++,,9,n,,- -A-v--..L.../$/Z///050l0011J1112*2c223 3F3334+4e4455M555676r667$7`7788P8899B999:6:t::;-;k;;<' >`>>?!?a??@#@d@@A)AjAAB0BrBBC:C}CDDGDDEEUEEF"FgFFG5G{GHHKHHIIcIIJ7J}JK KSKKL*LrLMMJMMN%NnNOOIOOP'PqPQQPQQR1R|RSS_SSTBTTU(UuUVV\VVWDWWX/X}XYYiYZZVZZ[E[[\5\\]']x]^^l^__a_``W``aOaabIbbcCccd@dde=eef=ffg=ggh?hhiCiijHjjkOkklWlmm`mnnknooxop+ppq:qqrKrss]sttptu(uuv>vvwVwxxnxy*yyzFz{{c{|!||}A}~~b~#G k͂0WGrׇ;iΉ3dʋ0cʍ1fΏ6n֑?zM _ɖ4 uL$h՛BdҞ@iءG&vVǥ8nRĩ7u\ЭD-u`ֲK³8%yhYѹJº;.! zpg_XQKFAǿ=ȼ:ɹ8ʷ6˶5̵5͵6ζ7ϸ9к<Ѿ?DINU\dlvۀ܊ݖޢ)߯6DScs 2F[p(@Xr4Pm8Ww)Km8BIM8BIM x<t\JFIFHH Adobe_CMAdobed            "?   3!1AQa"q2B#$Rb34rC%Scs5&DTdE£t6UeuF'Vfv7GWgw5!1AQaq"2B#R3$brCScs4%&5DTdEU6teuFVfv'7GWgw ?TCW&ϵrJn$I)U}ܟ+tSRKTS8BIM!UAdobe PhotoshopAdobe Photoshop CS28BIM".MM*bj(1r2i ' 'Adobe Photoshop CS2 Windows2010:01:17 09:53:06&(.HH8BIM`moptdTargetSettingsClrTObjc ColorTableClrsVlLsisExactboolMttCObjc NativeQuadBl longGrn longRd longTrnsbool addMetadatabool autoReduceboolcolorTableControlObjcColorTableControl lockedColorsVlLs shiftEntriesVlLsditherAlgorithmenumDitherAlgorithmDfsn ditherPercentlongd fileFormatenum FileFormatPNG8 interlacedbool noMatteColorbool numColorslongreductionAlgorithmenumReductionAlgorithmSelerolloverMasterPalettebooltransparencyDitherAlgorithmenumDitherAlgorithmNonetransparencyDitherAmountlongdwebShiftPercentlong zonedDitherObjc ZonedInfo channelIDlong emphasizeTextboolemphasizeVectorsboolfloorlongzonedHistogramWeightObjc ZonedInfo channelIDlong emphasizeTextboolemphasizeVectorsboolfloorlong8BIM-msetnullVersionlong8BIMms4w8BIMmaniIRFR8BIMAnDsnullAFStlongFrInVlLsObjcnullFrIDlongA$FStsVlLsObjcnullFsIDlongAFrmlongFsFrVlLslongA$LCntlong8BIMRoll8BIMmfriNNNN8BIMnorm ( Background8BIMluni Background8BIMlyid8BIMclbl8BIMinfx8BIMknko8BIMlspf8BIMlclr8BIMfxrp J"""8BIMnorm ( Down enabled8BIMluni Down enabled8BIMlyid8BIMclbl8BIMinfx8BIMknko8BIMlspf8BIMlclr8BIMfxrp@2̲@7 j J"""8BIMnorm ( Up enabled8BIMluni Up enabled8BIMlyid8BIMclbl8BIMinfx8BIMknko8BIMlspf8BIMlclr8BIMfxrp JJJJ8BIMnorm( Down disabled8BIMlfx2nullScl UntF#Prc@YqmasterFXSwitchboolSoFiObjcSoFienabboolMd enumBlnMNrmlOpctUntF#Prc@IClr ObjcRGBCRd doub@oGrn doub@oBl doub@o8BIMlrFX8BIMcmnS8BIMdsdw3x8BIMmul 8BIMisdw3x8BIMmul 8BIMoglw*8BIMscrn8BIMiglw+8BIMscrn8BIMbevlNx8BIMscrn8BIMmul 8BIMsofi"8BIMnorm8BIMluni Down disabled8BIMlyid8BIMclbl8BIMinfx8BIMknko8BIMlspf8BIMlclr8BIMfxrp JJJJ8BIMnorm ( Up Disabled8BIMlfx2nullScl UntF#Prc@YqmasterFXSwitchboolSoFiObjcSoFienabboolMd enumBlnMNrmlOpctUntF#Prc@IClr ObjcRGBCRd doub@oGrn doub@oBl doub@o8BIMlrFX8BIMcmnS8BIMdsdw3x8BIMmul 8BIMisdw3x8BIMmul 8BIMoglw*8BIMscrn8BIMiglw+8BIMscrn8BIMbevlNx8BIMscrn8BIMmul 8BIMsofi"8BIMnorm8BIMluni Up Disabled8BIMlyid8BIMclbl8BIMinfx8BIMknko8BIMlspf8BIMlclr8BIMfxrpxZZ00x  x00ZZxxZZ00x x00ZZx8BIMPatt    xZZ00x DataTablesSrc-1.10.11/images/favicon.ico000066400000000000000000000015761265711500300177260ustar00rootroot00000000000000h(   mqq=>>>98@:8???_dd=63rQIvlˈ}ЃylcRKP=:immorr4%wݍ{r吊쬦wwo_:5SUU8)$ʏֆ{xozs멥wpf<8djk1/.thԎuxo䛕벮䚕ێhbE42ڱT>7ҘЇ{tۈ컶ÿ吋oh}wytA={mnnbVә΍Џ޶ضlj}tmpk統~{OLBAANNNqcњȓЦÜvwlniqpSR922UUTqcМ˝ùֳĕr͈]\NL811~bVԡ׳Ż͟Ɩޮ︸}|QQA?ECCQ>8ԣڹƒĒҮ읜ZZUUv)'EDDn`޳ԱټlkPPGF2 :/+zҜڻ꽹xuPOTSI}3)%ugԝןݠ⑉snZXFE=kppLHGbIAZOcYVP;8u''G32^`a:99533NQQDataTablesSrc-1.10.11/images/sort_asc.png000066400000000000000000000002401265711500300201130ustar00rootroot00000000000000PNG  IHDRrP6gIDAT8c`.Ob6jV Ŀ8R1@LA@<j Oc#C3ېj/C3w1;)%O #F(hzl-=HIENDB`DataTablesSrc-1.10.11/images/sort_asc_disabled.png000066400000000000000000000002241265711500300217440ustar00rootroot00000000000000PNG  IHDRYG[IDAT(c`)ug6JMH֝w߹}G";s@pF#*t";@pvމd B RIENDB`DataTablesSrc-1.10.11/images/sort_both.png000066400000000000000000000003111265711500300203000ustar00rootroot00000000000000PNG  IHDRYGIDAT(ϵ1@@ՐHB PC"Nh6"bw 1~yy:Ĵ:k851#L>#BGfe+ % @*vkwOE FW^jB뭳f )L=Rs_(>i*IENDB`DataTablesSrc-1.10.11/images/sort_desc.png000066400000000000000000000002361265711500300202700ustar00rootroot00000000000000PNG  IHDRrP6eIDAT8c``@c DR c@ ļ?*#OD3l.HܰSP Ŀ1kOW=l- ѻIENDB`DataTablesSrc-1.10.11/images/sort_desc_disabled.png000066400000000000000000000002221265711500300221120ustar00rootroot00000000000000PNG  IHDRYGYIDAT(c` ܉w8y'2;;}wxqgsTѻ;e3lF|Ss-BɾN)aݙpa sBq(IENDB`DataTablesSrc-1.10.11/js/000077500000000000000000000000001265711500300147435ustar00rootroot00000000000000DataTablesSrc-1.10.11/js/DataTables.js000066400000000000000000000350651265711500300173160ustar00rootroot00000000000000/*! DataTables 1.10.11 * ©2008-2015 SpryMedia Ltd - datatables.net/license */ /** * @summary DataTables * @description Paginate, search and order HTML tables * @version 1.10.11 * @file jquery.dataTables.js * @author SpryMedia Ltd (www.sprymedia.co.uk) * @contact www.sprymedia.co.uk/contact * @copyright Copyright 2008-2015 SpryMedia Ltd. * * This source file is free software, available under the following license: * MIT license - http://datatables.net/license * * This source file is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the license files for details. * * For details please refer to: http://www.datatables.net */ /*jslint evil: true, undef: true, browser: true */ /*globals $,require,jQuery,define,_selector_run,_selector_opts,_selector_first,_selector_row_indexes,_ext,_Api,_api_register,_api_registerPlural,_re_new_lines,_re_html,_re_formatted_numeric,_re_escape_regex,_empty,_intVal,_numToDecimal,_isNumber,_isHtml,_htmlNumeric,_pluck,_pluck_order,_range,_stripHtml,_unique,_fnBuildAjax,_fnAjaxUpdate,_fnAjaxParameters,_fnAjaxUpdateDraw,_fnAjaxDataSrc,_fnAddColumn,_fnColumnOptions,_fnAdjustColumnSizing,_fnVisibleToColumnIndex,_fnColumnIndexToVisible,_fnVisbleColumns,_fnGetColumns,_fnColumnTypes,_fnApplyColumnDefs,_fnHungarianMap,_fnCamelToHungarian,_fnLanguageCompat,_fnBrowserDetect,_fnAddData,_fnAddTr,_fnNodeToDataIndex,_fnNodeToColumnIndex,_fnGetCellData,_fnSetCellData,_fnSplitObjNotation,_fnGetObjectDataFn,_fnSetObjectDataFn,_fnGetDataMaster,_fnClearTable,_fnDeleteIndex,_fnInvalidate,_fnGetRowElements,_fnCreateTr,_fnBuildHead,_fnDrawHead,_fnDraw,_fnReDraw,_fnAddOptionsHtml,_fnDetectHeader,_fnGetUniqueThs,_fnFeatureHtmlFilter,_fnFilterComplete,_fnFilterCustom,_fnFilterColumn,_fnFilter,_fnFilterCreateSearch,_fnEscapeRegex,_fnFilterData,_fnFeatureHtmlInfo,_fnUpdateInfo,_fnInfoMacros,_fnInitialise,_fnInitComplete,_fnLengthChange,_fnFeatureHtmlLength,_fnFeatureHtmlPaginate,_fnPageChange,_fnFeatureHtmlProcessing,_fnProcessingDisplay,_fnFeatureHtmlTable,_fnScrollDraw,_fnApplyToChildren,_fnCalculateColumnWidths,_fnThrottle,_fnConvertToWidth,_fnGetWidestNode,_fnGetMaxLenString,_fnStringToCss,_fnSortFlatten,_fnSort,_fnSortAria,_fnSortListener,_fnSortAttachListener,_fnSortingClasses,_fnSortData,_fnSaveState,_fnLoadState,_fnSettingsFromNode,_fnLog,_fnMap,_fnBindAction,_fnCallbackReg,_fnCallbackFire,_fnLengthOverflow,_fnRenderer,_fnDataSource,_fnRowAttributes*/ (function( factory ) { "use strict"; if ( typeof define === 'function' && define.amd ) { // AMD define( ['jquery'], function ( $ ) { return factory( $, window, document ); } ); } else if ( typeof exports === 'object' ) { // CommonJS module.exports = function (root, $) { if ( ! root ) { // CommonJS environments without a window global must pass a // root. This will give an error otherwise root = window; } if ( ! $ ) { $ = typeof window !== 'undefined' ? // jQuery's factory checks for a global window require('jquery') : require('jquery')( root ); } return factory( $, root, root.document ); }; } else { // Browser factory( jQuery, window, document ); } } (function( $, window, document, undefined ) { "use strict"; /** * DataTables is a plug-in for the jQuery Javascript library. It is a highly * flexible tool, based upon the foundations of progressive enhancement, * which will add advanced interaction controls to any HTML table. For a * full list of features please refer to * [DataTables.net](href="http://datatables.net). * * Note that the `DataTable` object is not a global variable but is aliased * to `jQuery.fn.DataTable` and `jQuery.fn.dataTable` through which it may * be accessed. * * @class * @param {object} [init={}] Configuration object for DataTables. Options * are defined by {@link DataTable.defaults} * @requires jQuery 1.7+ * * @example * // Basic initialisation * $(document).ready( function { * $('#example').dataTable(); * } ); * * @example * // Initialisation with configuration options - in this case, disable * // pagination and sorting. * $(document).ready( function { * $('#example').dataTable( { * "paginate": false, * "sort": false * } ); * } ); */ var DataTable; _buildInclude('core.internal.js'); _buildInclude('core.compat.js'); _buildInclude('core.columns.js'); _buildInclude('core.data.js'); _buildInclude('core.draw.js'); _buildInclude('core.ajax.js'); _buildInclude('core.filter.js'); _buildInclude('core.info.js'); _buildInclude('core.init.js'); _buildInclude('core.length.js'); _buildInclude('core.page.js'); _buildInclude('core.processing.js'); _buildInclude('core.scrolling.js'); _buildInclude('core.sizing.js'); _buildInclude('core.sort.js'); _buildInclude('core.state.js'); _buildInclude('core.support.js'); DataTable = function( options ) { _buildInclude('api.legacy.js'); var _that = this; var emptyInit = options === undefined; var len = this.length; if ( emptyInit ) { options = {}; } this.oApi = this.internal = _ext.internal; // Extend with old style plug-in API methods for ( var fn in DataTable.ext.internal ) { if ( fn ) { this[fn] = _fnExternApiFunc(fn); } } this.each(function() { // For each initialisation we want to give it a clean initialisation // object that can be bashed around var o = {}; var oInit = len > 1 ? // optimisation for single table case _fnExtend( o, options, true ) : options; _buildInclude('core.constructor.js'); } ); _that = null; return this; }; _buildInclude('api.base.js'); _buildInclude('api.table.js'); _buildInclude('api.draw.js'); _buildInclude('api.page.js'); _buildInclude('api.ajax.js'); _buildInclude('api.selectors.js'); _buildInclude('api.rows.js'); _buildInclude('api.row.details.js'); _buildInclude('api.columns.js'); _buildInclude('api.cells.js'); _buildInclude('api.order.js'); _buildInclude('api.search.js'); _buildInclude('api.state.js'); _buildInclude('api.static.js'); _buildInclude('api.core.js'); /** * Version string for plug-ins to check compatibility. Allowed format is * `a.b.c-d` where: a:int, b:int, c:int, d:string(dev|beta|alpha). `d` is used * only for non-release builds. See http://semver.org/ for more information. * @member * @type string * @default Version number */ DataTable.version = "1.10.11"; /** * Private data store, containing all of the settings objects that are * created for the tables on a given page. * * Note that the `DataTable.settings` object is aliased to * `jQuery.fn.dataTableExt` through which it may be accessed and * manipulated, or `jQuery.fn.dataTable.settings`. * @member * @type array * @default [] * @private */ DataTable.settings = []; /** * Object models container, for the various models that DataTables has * available to it. These models define the objects that are used to hold * the active state and configuration of the table. * @namespace */ DataTable.models = {}; _buildInclude('model.search.js'); _buildInclude('model.row.js'); _buildInclude('model.column.js'); _buildInclude('model.defaults.js'); _buildInclude('model.defaults.columns.js'); _buildInclude('model.settings.js'); /** * Extension object for DataTables that is used to provide all extension * options. * * Note that the `DataTable.ext` object is available through * `jQuery.fn.dataTable.ext` where it may be accessed and manipulated. It is * also aliased to `jQuery.fn.dataTableExt` for historic reasons. * @namespace * @extends DataTable.models.ext */ _buildInclude('ext.js'); _buildInclude('ext.classes.js'); _buildInclude('ext.paging.js'); _buildInclude('ext.types.js'); _buildInclude('ext.filter.js'); _buildInclude('ext.sorting.js'); _buildInclude('ext.renderer.js'); _buildInclude('ext.helpers.js'); _buildInclude('api.internal.js'); // jQuery access $.fn.dataTable = DataTable; // Provide access to the host jQuery object (circular reference) DataTable.$ = $; // Legacy aliases $.fn.dataTableSettings = DataTable.settings; $.fn.dataTableExt = DataTable.ext; // With a capital `D` we return a DataTables API instance rather than a // jQuery object $.fn.DataTable = function ( opts ) { return $(this).dataTable( opts ).api(); }; // All properties that are available to $.fn.dataTable should also be // available on $.fn.DataTable $.each( DataTable, function ( prop, val ) { $.fn.DataTable[ prop ] = val; } ); // Information about events fired by DataTables - for documentation. /** * Draw event, fired whenever the table is redrawn on the page, at the same * point as fnDrawCallback. This may be useful for binding events or * performing calculations when the table is altered at all. * @name DataTable#draw.dt * @event * @param {event} e jQuery event object * @param {object} o DataTables settings object {@link DataTable.models.oSettings} */ /** * Search event, fired when the searching applied to the table (using the * built-in global search, or column filters) is altered. * @name DataTable#search.dt * @event * @param {event} e jQuery event object * @param {object} o DataTables settings object {@link DataTable.models.oSettings} */ /** * Page change event, fired when the paging of the table is altered. * @name DataTable#page.dt * @event * @param {event} e jQuery event object * @param {object} o DataTables settings object {@link DataTable.models.oSettings} */ /** * Order event, fired when the ordering applied to the table is altered. * @name DataTable#order.dt * @event * @param {event} e jQuery event object * @param {object} o DataTables settings object {@link DataTable.models.oSettings} */ /** * DataTables initialisation complete event, fired when the table is fully * drawn, including Ajax data loaded, if Ajax data is required. * @name DataTable#init.dt * @event * @param {event} e jQuery event object * @param {object} oSettings DataTables settings object * @param {object} json The JSON object request from the server - only * present if client-side Ajax sourced data is used */ /** * State save event, fired when the table has changed state a new state save * is required. This event allows modification of the state saving object * prior to actually doing the save, including addition or other state * properties (for plug-ins) or modification of a DataTables core property. * @name DataTable#stateSaveParams.dt * @event * @param {event} e jQuery event object * @param {object} oSettings DataTables settings object * @param {object} json The state information to be saved */ /** * State load event, fired when the table is loading state from the stored * data, but prior to the settings object being modified by the saved state * - allowing modification of the saved state is required or loading of * state for a plug-in. * @name DataTable#stateLoadParams.dt * @event * @param {event} e jQuery event object * @param {object} oSettings DataTables settings object * @param {object} json The saved state information */ /** * State loaded event, fired when state has been loaded from stored data and * the settings object has been modified by the loaded data. * @name DataTable#stateLoaded.dt * @event * @param {event} e jQuery event object * @param {object} oSettings DataTables settings object * @param {object} json The saved state information */ /** * Processing event, fired when DataTables is doing some kind of processing * (be it, order, searcg or anything else). It can be used to indicate to * the end user that there is something happening, or that something has * finished. * @name DataTable#processing.dt * @event * @param {event} e jQuery event object * @param {object} oSettings DataTables settings object * @param {boolean} bShow Flag for if DataTables is doing processing or not */ /** * Ajax (XHR) event, fired whenever an Ajax request is completed from a * request to made to the server for new data. This event is called before * DataTables processed the returned data, so it can also be used to pre- * process the data returned from the server, if needed. * * Note that this trigger is called in `fnServerData`, if you override * `fnServerData` and which to use this event, you need to trigger it in you * success function. * @name DataTable#xhr.dt * @event * @param {event} e jQuery event object * @param {object} o DataTables settings object {@link DataTable.models.oSettings} * @param {object} json JSON returned from the server * * @example * // Use a custom property returned from the server in another DOM element * $('#table').dataTable().on('xhr.dt', function (e, settings, json) { * $('#status').html( json.status ); * } ); * * @example * // Pre-process the data returned from the server * $('#table').dataTable().on('xhr.dt', function (e, settings, json) { * for ( var i=0, ien=json.aaData.length ; i 0 ) { return ctx[0].json; } // else return undefined; } ); /** * Get the data submitted in the last Ajax request */ _api_register( 'ajax.params()', function () { var ctx = this.context; if ( ctx.length > 0 ) { return ctx[0].oAjaxData; } // else return undefined; } ); /** * Reload tables from the Ajax data source. Note that this function will * automatically re-draw the table when the remote data has been loaded. * * @param {boolean} [reset=true] Reset (default) or hold the current paging * position. A full re-sort and re-filter is performed when this method is * called, which is why the pagination reset is the default action. * @returns {DataTables.Api} this */ _api_register( 'ajax.reload()', function ( callback, resetPaging ) { return this.iterator( 'table', function (settings) { __reload( settings, resetPaging===false, callback ); } ); } ); /** * Get the current Ajax URL. Note that this returns the URL from the first * table in the current context. * * @return {string} Current Ajax source URL *//** * Set the Ajax URL. Note that this will set the URL for all tables in the * current context. * * @param {string} url URL to set. * @returns {DataTables.Api} this */ _api_register( 'ajax.url()', function ( url ) { var ctx = this.context; if ( url === undefined ) { // get if ( ctx.length === 0 ) { return undefined; } ctx = ctx[0]; return ctx.ajax ? $.isPlainObject( ctx.ajax ) ? ctx.ajax.url : ctx.ajax : ctx.sAjaxSource; } // set return this.iterator( 'table', function ( settings ) { if ( $.isPlainObject( settings.ajax ) ) { settings.ajax.url = url; } else { settings.ajax = url; } // No need to consider sAjaxSource here since DataTables gives priority // to `ajax` over `sAjaxSource`. So setting `ajax` here, renders any // value of `sAjaxSource` redundant. } ); } ); /** * Load data from the newly set Ajax URL. Note that this method is only * available when `ajax.url()` is used to set a URL. Additionally, this method * has the same effect as calling `ajax.reload()` but is provided for * convenience when setting a new URL. Like `ajax.reload()` it will * automatically redraw the table once the remote data has been loaded. * * @returns {DataTables.Api} this */ _api_register( 'ajax.url().load()', function ( callback, resetPaging ) { // Same as a reload, but makes sense to present it for easy access after a // url change return this.iterator( 'table', function ( ctx ) { __reload( ctx, resetPaging===false, callback ); } ); } ); DataTablesSrc-1.10.11/js/api/api.base.js000066400000000000000000000333701265711500300175420ustar00rootroot00000000000000 /** * Computed structure of the DataTables API, defined by the options passed to * `DataTable.Api.register()` when building the API. * * The structure is built in order to speed creation and extension of the Api * objects since the extensions are effectively pre-parsed. * * The array is an array of objects with the following structure, where this * base array represents the Api prototype base: * * [ * { * name: 'data' -- string - Property name * val: function () {}, -- function - Api method (or undefined if just an object * methodExt: [ ... ], -- array - Array of Api object definitions to extend the method result * propExt: [ ... ] -- array - Array of Api object definitions to extend the property * }, * { * name: 'row' * val: {}, * methodExt: [ ... ], * propExt: [ * { * name: 'data' * val: function () {}, * methodExt: [ ... ], * propExt: [ ... ] * }, * ... * ] * } * ] * * @type {Array} * @ignore */ var __apiStruct = []; /** * `Array.prototype` reference. * * @type object * @ignore */ var __arrayProto = Array.prototype; /** * Abstraction for `context` parameter of the `Api` constructor to allow it to * take several different forms for ease of use. * * Each of the input parameter types will be converted to a DataTables settings * object where possible. * * @param {string|node|jQuery|object} mixed DataTable identifier. Can be one * of: * * * `string` - jQuery selector. Any DataTables' matching the given selector * with be found and used. * * `node` - `TABLE` node which has already been formed into a DataTable. * * `jQuery` - A jQuery object of `TABLE` nodes. * * `object` - DataTables settings object * * `DataTables.Api` - API instance * @return {array|null} Matching DataTables settings objects. `null` or * `undefined` is returned if no matching DataTable is found. * @ignore */ var _toSettings = function ( mixed ) { var idx, jq; var settings = DataTable.settings; var tables = $.map( settings, function (el, i) { return el.nTable; } ); if ( ! mixed ) { return []; } else if ( mixed.nTable && mixed.oApi ) { // DataTables settings object return [ mixed ]; } else if ( mixed.nodeName && mixed.nodeName.toLowerCase() === 'table' ) { // Table node idx = $.inArray( mixed, tables ); return idx !== -1 ? [ settings[idx] ] : null; } else if ( mixed && typeof mixed.settings === 'function' ) { return mixed.settings().toArray(); } else if ( typeof mixed === 'string' ) { // jQuery selector jq = $(mixed); } else if ( mixed instanceof $ ) { // jQuery object (also DataTables instance) jq = mixed; } if ( jq ) { return jq.map( function(i) { idx = $.inArray( this, tables ); return idx !== -1 ? settings[idx] : null; } ).toArray(); } }; /** * DataTables API class - used to control and interface with one or more * DataTables enhanced tables. * * The API class is heavily based on jQuery, presenting a chainable interface * that you can use to interact with tables. Each instance of the API class has * a "context" - i.e. the tables that it will operate on. This could be a single * table, all tables on a page or a sub-set thereof. * * Additionally the API is designed to allow you to easily work with the data in * the tables, retrieving and manipulating it as required. This is done by * presenting the API class as an array like interface. The contents of the * array depend upon the actions requested by each method (for example * `rows().nodes()` will return an array of nodes, while `rows().data()` will * return an array of objects or arrays depending upon your table's * configuration). The API object has a number of array like methods (`push`, * `pop`, `reverse` etc) as well as additional helper methods (`each`, `pluck`, * `unique` etc) to assist your working with the data held in a table. * * Most methods (those which return an Api instance) are chainable, which means * the return from a method call also has all of the methods available that the * top level object had. For example, these two calls are equivalent: * * // Not chained * api.row.add( {...} ); * api.draw(); * * // Chained * api.row.add( {...} ).draw(); * * @class DataTable.Api * @param {array|object|string|jQuery} context DataTable identifier. This is * used to define which DataTables enhanced tables this API will operate on. * Can be one of: * * * `string` - jQuery selector. Any DataTables' matching the given selector * with be found and used. * * `node` - `TABLE` node which has already been formed into a DataTable. * * `jQuery` - A jQuery object of `TABLE` nodes. * * `object` - DataTables settings object * @param {array} [data] Data to initialise the Api instance with. * * @example * // Direct initialisation during DataTables construction * var api = $('#example').DataTable(); * * @example * // Initialisation using a DataTables jQuery object * var api = $('#example').dataTable().api(); * * @example * // Initialisation as a constructor * var api = new $.fn.DataTable.Api( 'table.dataTable' ); */ _Api = function ( context, data ) { if ( ! (this instanceof _Api) ) { return new _Api( context, data ); } var settings = []; var ctxSettings = function ( o ) { var a = _toSettings( o ); if ( a ) { settings = settings.concat( a ); } }; if ( $.isArray( context ) ) { for ( var i=0, ien=context.length ; i idx ? new _Api( ctx[idx], this[idx] ) : null; }, filter: function ( fn ) { var a = []; if ( __arrayProto.filter ) { a = __arrayProto.filter.call( this, fn, this ); } else { // Compatibility for browsers without EMCA-252-5 (JS 1.6) for ( var i=0, ien=this.length ; i=0 count from left, <0 count from right) * "{integer}:visIdx" - visible column index (i.e. translate to column index) (>=0 count from left, <0 count from right) * "{integer}:visible" - alias for {integer}:visIdx (>=0 count from left, <0 count from right) * "{string}:name" - column name * "{string}" - jQuery selector on column header nodes * */ // can be an array of these items, comma separated list, or an array of comma // separated lists var __re_column_selector = /^(.+):(name|visIdx|visible)$/; // r1 and r2 are redundant - but it means that the parameters match for the // iterator callback in columns().data() var __columnData = function ( settings, column, r1, r2, rows ) { var a = []; for ( var row=0, ien=rows.length ; row= 0 ? selInt : // Count from left columns.length + selInt // Count from right (+ because its a negative value) ]; } // Selector = function if ( typeof s === 'function' ) { var rows = _selector_row_indexes( settings, opts ); return $.map( columns, function (col, idx) { return s( idx, __columnData( settings, idx, 0, 0, rows ), nodes[ idx ] ) ? idx : null; } ); } // jQuery or string selector var match = typeof s === 'string' ? s.match( __re_column_selector ) : ''; if ( match ) { switch( match[2] ) { case 'visIdx': case 'visible': var idx = parseInt( match[1], 10 ); // Visible index given, convert to column index if ( idx < 0 ) { // Counting from the right var visColumns = $.map( columns, function (col,i) { return col.bVisible ? i : null; } ); return [ visColumns[ visColumns.length + idx ] ]; } // Counting from the left return [ _fnVisibleToColumnIndex( settings, idx ) ]; case 'name': // match by name. `names` is column index complete and in order return $.map( names, function (name, i) { return name === match[1] ? i : null; } ); default: return []; } } // Cell in the table body if ( s.nodeName && s._DT_CellIndex ) { return [ s._DT_CellIndex.column ]; } // jQuery selector on the TH elements for the columns var jqResult = $( nodes ) .filter( s ) .map( function () { return $.inArray( this, nodes ); // `nodes` is column index complete and in order } ) .toArray(); if ( jqResult.length || ! s.nodeName ) { return jqResult; } // Otherwise a node which might have a `dt-column` data attribute, or be // a child or such an element var host = $(s).closest('*[data-dt-column]'); return host.length ? [ host.data('dt-column') ] : []; }; return _selector_run( 'column', selector, run, settings, opts ); }; var __setColumnVis = function ( settings, column, vis, recalc ) { var cols = settings.aoColumns, col = cols[ column ], data = settings.aoData, row, cells, i, ien, tr; // Get if ( vis === undefined ) { return col.bVisible; } // Set // No change if ( col.bVisible === vis ) { return; } if ( vis ) { // Insert column // Need to decide if we should use appendChild or insertBefore var insertBefore = $.inArray( true, _pluck(cols, 'bVisible'), column+1 ); for ( i=0, ien=data.length ; i *
  • 1D array of data - add a single row with the data provided
  • *
  • 2D array of arrays - add multiple rows in a single call
  • *
  • object - data object when using mData
  • *
  • array of objects - multiple data objects when using mData
  • * * @param {bool} [redraw=true] redraw the table or not * @returns {array} An array of integers, representing the list of indexes in * aoData ({@link DataTable.models.oSettings}) that have been added to * the table. * @dtopt API * @deprecated Since v1.10 * * @example * // Global var for counter * var giCount = 2; * * $(document).ready(function() { * $('#example').dataTable(); * } ); * * function fnClickAddRow() { * $('#example').dataTable().fnAddData( [ * giCount+".1", * giCount+".2", * giCount+".3", * giCount+".4" ] * ); * * giCount++; * } */ this.fnAddData = function( data, redraw ) { var api = this.api( true ); /* Check if we want to add multiple rows or not */ var rows = $.isArray(data) && ( $.isArray(data[0]) || $.isPlainObject(data[0]) ) ? api.rows.add( data ) : api.row.add( data ); if ( redraw === undefined || redraw ) { api.draw(); } return rows.flatten().toArray(); }; /** * This function will make DataTables recalculate the column sizes, based on the data * contained in the table and the sizes applied to the columns (in the DOM, CSS or * through the sWidth parameter). This can be useful when the width of the table's * parent element changes (for example a window resize). * @param {boolean} [bRedraw=true] Redraw the table or not, you will typically want to * @dtopt API * @deprecated Since v1.10 * * @example * $(document).ready(function() { * var oTable = $('#example').dataTable( { * "sScrollY": "200px", * "bPaginate": false * } ); * * $(window).bind('resize', function () { * oTable.fnAdjustColumnSizing(); * } ); * } ); */ this.fnAdjustColumnSizing = function ( bRedraw ) { var api = this.api( true ).columns.adjust(); var settings = api.settings()[0]; var scroll = settings.oScroll; if ( bRedraw === undefined || bRedraw ) { api.draw( false ); } else if ( scroll.sX !== "" || scroll.sY !== "" ) { /* If not redrawing, but scrolling, we want to apply the new column sizes anyway */ _fnScrollDraw( settings ); } }; /** * Quickly and simply clear a table * @param {bool} [bRedraw=true] redraw the table or not * @dtopt API * @deprecated Since v1.10 * * @example * $(document).ready(function() { * var oTable = $('#example').dataTable(); * * // Immediately 'nuke' the current rows (perhaps waiting for an Ajax callback...) * oTable.fnClearTable(); * } ); */ this.fnClearTable = function( bRedraw ) { var api = this.api( true ).clear(); if ( bRedraw === undefined || bRedraw ) { api.draw(); } }; /** * The exact opposite of 'opening' a row, this function will close any rows which * are currently 'open'. * @param {node} nTr the table row to 'close' * @returns {int} 0 on success, or 1 if failed (can't find the row) * @dtopt API * @deprecated Since v1.10 * * @example * $(document).ready(function() { * var oTable; * * // 'open' an information row when a row is clicked on * $('#example tbody tr').click( function () { * if ( oTable.fnIsOpen(this) ) { * oTable.fnClose( this ); * } else { * oTable.fnOpen( this, "Temporary row opened", "info_row" ); * } * } ); * * oTable = $('#example').dataTable(); * } ); */ this.fnClose = function( nTr ) { this.api( true ).row( nTr ).child.hide(); }; /** * Remove a row for the table * @param {mixed} target The index of the row from aoData to be deleted, or * the TR element you want to delete * @param {function|null} [callBack] Callback function * @param {bool} [redraw=true] Redraw the table or not * @returns {array} The row that was deleted * @dtopt API * @deprecated Since v1.10 * * @example * $(document).ready(function() { * var oTable = $('#example').dataTable(); * * // Immediately remove the first row * oTable.fnDeleteRow( 0 ); * } ); */ this.fnDeleteRow = function( target, callback, redraw ) { var api = this.api( true ); var rows = api.rows( target ); var settings = rows.settings()[0]; var data = settings.aoData[ rows[0][0] ]; rows.remove(); if ( callback ) { callback.call( this, settings, data ); } if ( redraw === undefined || redraw ) { api.draw(); } return data; }; /** * Restore the table to it's original state in the DOM by removing all of DataTables * enhancements, alterations to the DOM structure of the table and event listeners. * @param {boolean} [remove=false] Completely remove the table from the DOM * @dtopt API * @deprecated Since v1.10 * * @example * $(document).ready(function() { * // This example is fairly pointless in reality, but shows how fnDestroy can be used * var oTable = $('#example').dataTable(); * oTable.fnDestroy(); * } ); */ this.fnDestroy = function ( remove ) { this.api( true ).destroy( remove ); }; /** * Redraw the table * @param {bool} [complete=true] Re-filter and resort (if enabled) the table before the draw. * @dtopt API * @deprecated Since v1.10 * * @example * $(document).ready(function() { * var oTable = $('#example').dataTable(); * * // Re-draw the table - you wouldn't want to do it here, but it's an example :-) * oTable.fnDraw(); * } ); */ this.fnDraw = function( complete ) { // Note that this isn't an exact match to the old call to _fnDraw - it takes // into account the new data, but can hold position. this.api( true ).draw( complete ); }; /** * Filter the input based on data * @param {string} sInput String to filter the table on * @param {int|null} [iColumn] Column to limit filtering to * @param {bool} [bRegex=false] Treat as regular expression or not * @param {bool} [bSmart=true] Perform smart filtering or not * @param {bool} [bShowGlobal=true] Show the input global filter in it's input box(es) * @param {bool} [bCaseInsensitive=true] Do case-insensitive matching (true) or not (false) * @dtopt API * @deprecated Since v1.10 * * @example * $(document).ready(function() { * var oTable = $('#example').dataTable(); * * // Sometime later - filter... * oTable.fnFilter( 'test string' ); * } ); */ this.fnFilter = function( sInput, iColumn, bRegex, bSmart, bShowGlobal, bCaseInsensitive ) { var api = this.api( true ); if ( iColumn === null || iColumn === undefined ) { api.search( sInput, bRegex, bSmart, bCaseInsensitive ); } else { api.column( iColumn ).search( sInput, bRegex, bSmart, bCaseInsensitive ); } api.draw(); }; /** * Get the data for the whole table, an individual row or an individual cell based on the * provided parameters. * @param {int|node} [src] A TR row node, TD/TH cell node or an integer. If given as * a TR node then the data source for the whole row will be returned. If given as a * TD/TH cell node then iCol will be automatically calculated and the data for the * cell returned. If given as an integer, then this is treated as the aoData internal * data index for the row (see fnGetPosition) and the data for that row used. * @param {int} [col] Optional column index that you want the data of. * @returns {array|object|string} If mRow is undefined, then the data for all rows is * returned. If mRow is defined, just data for that row, and is iCol is * defined, only data for the designated cell is returned. * @dtopt API * @deprecated Since v1.10 * * @example * // Row data * $(document).ready(function() { * oTable = $('#example').dataTable(); * * oTable.$('tr').click( function () { * var data = oTable.fnGetData( this ); * // ... do something with the array / object of data for the row * } ); * } ); * * @example * // Individual cell data * $(document).ready(function() { * oTable = $('#example').dataTable(); * * oTable.$('td').click( function () { * var sData = oTable.fnGetData( this ); * alert( 'The cell clicked on had the value of '+sData ); * } ); * } ); */ this.fnGetData = function( src, col ) { var api = this.api( true ); if ( src !== undefined ) { var type = src.nodeName ? src.nodeName.toLowerCase() : ''; return col !== undefined || type == 'td' || type == 'th' ? api.cell( src, col ).data() : api.row( src ).data() || null; } return api.data().toArray(); }; /** * Get an array of the TR nodes that are used in the table's body. Note that you will * typically want to use the '$' API method in preference to this as it is more * flexible. * @param {int} [iRow] Optional row index for the TR element you want * @returns {array|node} If iRow is undefined, returns an array of all TR elements * in the table's body, or iRow is defined, just the TR element requested. * @dtopt API * @deprecated Since v1.10 * * @example * $(document).ready(function() { * var oTable = $('#example').dataTable(); * * // Get the nodes from the table * var nNodes = oTable.fnGetNodes( ); * } ); */ this.fnGetNodes = function( iRow ) { var api = this.api( true ); return iRow !== undefined ? api.row( iRow ).node() : api.rows().nodes().flatten().toArray(); }; /** * Get the array indexes of a particular cell from it's DOM element * and column index including hidden columns * @param {node} node this can either be a TR, TD or TH in the table's body * @returns {int} If nNode is given as a TR, then a single index is returned, or * if given as a cell, an array of [row index, column index (visible), * column index (all)] is given. * @dtopt API * @deprecated Since v1.10 * * @example * $(document).ready(function() { * $('#example tbody td').click( function () { * // Get the position of the current data from the node * var aPos = oTable.fnGetPosition( this ); * * // Get the data array for this row * var aData = oTable.fnGetData( aPos[0] ); * * // Update the data array and return the value * aData[ aPos[1] ] = 'clicked'; * this.innerHTML = 'clicked'; * } ); * * // Init DataTables * oTable = $('#example').dataTable(); * } ); */ this.fnGetPosition = function( node ) { var api = this.api( true ); var nodeName = node.nodeName.toUpperCase(); if ( nodeName == 'TR' ) { return api.row( node ).index(); } else if ( nodeName == 'TD' || nodeName == 'TH' ) { var cell = api.cell( node ).index(); return [ cell.row, cell.columnVisible, cell.column ]; } return null; }; /** * Check to see if a row is 'open' or not. * @param {node} nTr the table row to check * @returns {boolean} true if the row is currently open, false otherwise * @dtopt API * @deprecated Since v1.10 * * @example * $(document).ready(function() { * var oTable; * * // 'open' an information row when a row is clicked on * $('#example tbody tr').click( function () { * if ( oTable.fnIsOpen(this) ) { * oTable.fnClose( this ); * } else { * oTable.fnOpen( this, "Temporary row opened", "info_row" ); * } * } ); * * oTable = $('#example').dataTable(); * } ); */ this.fnIsOpen = function( nTr ) { return this.api( true ).row( nTr ).child.isShown(); }; /** * This function will place a new row directly after a row which is currently * on display on the page, with the HTML contents that is passed into the * function. This can be used, for example, to ask for confirmation that a * particular record should be deleted. * @param {node} nTr The table row to 'open' * @param {string|node|jQuery} mHtml The HTML to put into the row * @param {string} sClass Class to give the new TD cell * @returns {node} The row opened. Note that if the table row passed in as the * first parameter, is not found in the table, this method will silently * return. * @dtopt API * @deprecated Since v1.10 * * @example * $(document).ready(function() { * var oTable; * * // 'open' an information row when a row is clicked on * $('#example tbody tr').click( function () { * if ( oTable.fnIsOpen(this) ) { * oTable.fnClose( this ); * } else { * oTable.fnOpen( this, "Temporary row opened", "info_row" ); * } * } ); * * oTable = $('#example').dataTable(); * } ); */ this.fnOpen = function( nTr, mHtml, sClass ) { return this.api( true ) .row( nTr ) .child( mHtml, sClass ) .show() .child()[0]; }; /** * Change the pagination - provides the internal logic for pagination in a simple API * function. With this function you can have a DataTables table go to the next, * previous, first or last pages. * @param {string|int} mAction Paging action to take: "first", "previous", "next" or "last" * or page number to jump to (integer), note that page 0 is the first page. * @param {bool} [bRedraw=true] Redraw the table or not * @dtopt API * @deprecated Since v1.10 * * @example * $(document).ready(function() { * var oTable = $('#example').dataTable(); * oTable.fnPageChange( 'next' ); * } ); */ this.fnPageChange = function ( mAction, bRedraw ) { var api = this.api( true ).page( mAction ); if ( bRedraw === undefined || bRedraw ) { api.draw(false); } }; /** * Show a particular column * @param {int} iCol The column whose display should be changed * @param {bool} bShow Show (true) or hide (false) the column * @param {bool} [bRedraw=true] Redraw the table or not * @dtopt API * @deprecated Since v1.10 * * @example * $(document).ready(function() { * var oTable = $('#example').dataTable(); * * // Hide the second column after initialisation * oTable.fnSetColumnVis( 1, false ); * } ); */ this.fnSetColumnVis = function ( iCol, bShow, bRedraw ) { var api = this.api( true ).column( iCol ).visible( bShow ); if ( bRedraw === undefined || bRedraw ) { api.columns.adjust().draw(); } }; /** * Get the settings for a particular table for external manipulation * @returns {object} DataTables settings object. See * {@link DataTable.models.oSettings} * @dtopt API * @deprecated Since v1.10 * * @example * $(document).ready(function() { * var oTable = $('#example').dataTable(); * var oSettings = oTable.fnSettings(); * * // Show an example parameter from the settings * alert( oSettings._iDisplayStart ); * } ); */ this.fnSettings = function() { return _fnSettingsFromNode( this[_ext.iApiIndex] ); }; /** * Sort the table by a particular column * @param {int} iCol the data index to sort on. Note that this will not match the * 'display index' if you have hidden data entries * @dtopt API * @deprecated Since v1.10 * * @example * $(document).ready(function() { * var oTable = $('#example').dataTable(); * * // Sort immediately with columns 0 and 1 * oTable.fnSort( [ [0,'asc'], [1,'asc'] ] ); * } ); */ this.fnSort = function( aaSort ) { this.api( true ).order( aaSort ).draw(); }; /** * Attach a sort listener to an element for a given column * @param {node} nNode the element to attach the sort listener to * @param {int} iColumn the column that a click on this node will sort on * @param {function} [fnCallback] callback function when sort is run * @dtopt API * @deprecated Since v1.10 * * @example * $(document).ready(function() { * var oTable = $('#example').dataTable(); * * // Sort on column 1, when 'sorter' is clicked on * oTable.fnSortListener( document.getElementById('sorter'), 1 ); * } ); */ this.fnSortListener = function( nNode, iColumn, fnCallback ) { this.api( true ).order.listener( nNode, iColumn, fnCallback ); }; /** * Update a table cell or row - this method will accept either a single value to * update the cell with, an array of values with one element for each column or * an object in the same format as the original data source. The function is * self-referencing in order to make the multi column updates easier. * @param {object|array|string} mData Data to update the cell/row with * @param {node|int} mRow TR element you want to update or the aoData index * @param {int} [iColumn] The column to update, give as null or undefined to * update a whole row. * @param {bool} [bRedraw=true] Redraw the table or not * @param {bool} [bAction=true] Perform pre-draw actions or not * @returns {int} 0 on success, 1 on error * @dtopt API * @deprecated Since v1.10 * * @example * $(document).ready(function() { * var oTable = $('#example').dataTable(); * oTable.fnUpdate( 'Example update', 0, 0 ); // Single cell * oTable.fnUpdate( ['a', 'b', 'c', 'd', 'e'], $('tbody tr')[0] ); // Row * } ); */ this.fnUpdate = function( mData, mRow, iColumn, bRedraw, bAction ) { var api = this.api( true ); if ( iColumn === undefined || iColumn === null ) { api.row( mRow ).data( mData ); } else { api.cell( mRow, iColumn ).data( mData ); } if ( bAction === undefined || bAction ) { api.columns.adjust(); } if ( bRedraw === undefined || bRedraw ) { api.draw(); } return 0; }; /** * Provide a common method for plug-ins to check the version of DataTables being used, in order * to ensure compatibility. * @param {string} sVersion Version string to check for, in the format "X.Y.Z". Note that the * formats "X" and "X.Y" are also acceptable. * @returns {boolean} true if this version of DataTables is greater or equal to the required * version, or false if this version of DataTales is not suitable * @method * @dtopt API * @deprecated Since v1.10 * * @example * $(document).ready(function() { * var oTable = $('#example').dataTable(); * alert( oTable.fnVersionCheck( '1.9.0' ) ); * } ); */ this.fnVersionCheck = _ext.fnVersionCheck; DataTablesSrc-1.10.11/js/api/api.order.js000066400000000000000000000061341265711500300177410ustar00rootroot00000000000000 /** * Get current ordering (sorting) that has been applied to the table. * * @returns {array} 2D array containing the sorting information for the first * table in the current context. Each element in the parent array represents * a column being sorted upon (i.e. multi-sorting with two columns would have * 2 inner arrays). The inner arrays may have 2 or 3 elements. The first is * the column index that the sorting condition applies to, the second is the * direction of the sort (`desc` or `asc`) and, optionally, the third is the * index of the sorting order from the `column.sorting` initialisation array. *//** * Set the ordering for the table. * * @param {integer} order Column index to sort upon. * @param {string} direction Direction of the sort to be applied (`asc` or `desc`) * @returns {DataTables.Api} this *//** * Set the ordering for the table. * * @param {array} order 1D array of sorting information to be applied. * @param {array} [...] Optional additional sorting conditions * @returns {DataTables.Api} this *//** * Set the ordering for the table. * * @param {array} order 2D array of sorting information to be applied. * @returns {DataTables.Api} this */ _api_register( 'order()', function ( order, dir ) { var ctx = this.context; if ( order === undefined ) { // get return ctx.length !== 0 ? ctx[0].aaSorting : undefined; } // set if ( typeof order === 'number' ) { // Simple column / direction passed in order = [ [ order, dir ] ]; } else if ( ! $.isArray( order[0] ) ) { // Arguments passed in (list of 1D arrays) order = Array.prototype.slice.call( arguments ); } // otherwise a 2D array was passed in return this.iterator( 'table', function ( settings ) { settings.aaSorting = order.slice(); } ); } ); /** * Attach a sort listener to an element for a given column * * @param {node|jQuery|string} node Identifier for the element(s) to attach the * listener to. This can take the form of a single DOM node, a jQuery * collection of nodes or a jQuery selector which will identify the node(s). * @param {integer} column the column that a click on this node will sort on * @param {function} [callback] callback function when sort is run * @returns {DataTables.Api} this */ _api_register( 'order.listener()', function ( node, column, callback ) { return this.iterator( 'table', function ( settings ) { _fnSortAttachListener( settings, node, column, callback ); } ); } ); _api_register( 'order.fixed()', function ( set ) { if ( ! set ) { var ctx = this.context; var fixed = ctx.length ? ctx[0].aaSortingFixed : undefined; return $.isArray( fixed ) ? { pre: fixed } : fixed; } return this.iterator( 'table', function ( settings ) { settings.aaSortingFixed = $.extend( true, {}, set ); } ); } ); // Order by the selected column(s) _api_register( [ 'columns().order()', 'column().order()' ], function ( dir ) { var that = this; return this.iterator( 'table', function ( settings, i ) { var sort = []; $.each( that[i], function (j, col) { sort.push( [ col, dir ] ); } ); settings.aaSorting = sort; } ); } ); DataTablesSrc-1.10.11/js/api/api.page.js000066400000000000000000000063071265711500300175440ustar00rootroot00000000000000 /** * Get the current page index. * * @return {integer} Current page index (zero based) *//** * Set the current page. * * Note that if you attempt to show a page which does not exist, DataTables will * not throw an error, but rather reset the paging. * * @param {integer|string} action The paging action to take. This can be one of: * * `integer` - The page index to jump to * * `string` - An action to take: * * `first` - Jump to first page. * * `next` - Jump to the next page * * `previous` - Jump to previous page * * `last` - Jump to the last page. * @returns {DataTables.Api} this */ _api_register( 'page()', function ( action ) { if ( action === undefined ) { return this.page.info().page; // not an expensive call } // else, have an action to take on all tables return this.iterator( 'table', function ( settings ) { _fnPageChange( settings, action ); } ); } ); /** * Paging information for the first table in the current context. * * If you require paging information for another table, use the `table()` method * with a suitable selector. * * @return {object} Object with the following properties set: * * `page` - Current page index (zero based - i.e. the first page is `0`) * * `pages` - Total number of pages * * `start` - Display index for the first record shown on the current page * * `end` - Display index for the last record shown on the current page * * `length` - Display length (number of records). Note that generally `start * + length = end`, but this is not always true, for example if there are * only 2 records to show on the final page, with a length of 10. * * `recordsTotal` - Full data set length * * `recordsDisplay` - Data set length once the current filtering criterion * are applied. */ _api_register( 'page.info()', function ( action ) { if ( this.context.length === 0 ) { return undefined; } var settings = this.context[0], start = settings._iDisplayStart, len = settings.oFeatures.bPaginate ? settings._iDisplayLength : -1, visRecords = settings.fnRecordsDisplay(), all = len === -1; return { "page": all ? 0 : Math.floor( start / len ), "pages": all ? 1 : Math.ceil( visRecords / len ), "start": start, "end": settings.fnDisplayEnd(), "length": len, "recordsTotal": settings.fnRecordsTotal(), "recordsDisplay": visRecords, "serverSide": _fnDataSource( settings ) === 'ssp' }; } ); /** * Get the current page length. * * @return {integer} Current page length. Note `-1` indicates that all records * are to be shown. *//** * Set the current page length. * * @param {integer} Page length to set. Use `-1` to show all records. * @returns {DataTables.Api} this */ _api_register( 'page.len()', function ( len ) { // Note that we can't call this function 'length()' because `length` // is a Javascript property of functions which defines how many arguments // the function expects. if ( len === undefined ) { return this.context.length !== 0 ? this.context[0]._iDisplayLength : undefined; } // else, set the page length return this.iterator( 'table', function ( settings ) { _fnLengthChange( settings, len ); } ); } ); DataTablesSrc-1.10.11/js/api/api.row.details.js000066400000000000000000000114541265711500300210620ustar00rootroot00000000000000 var __details_add = function ( ctx, row, data, klass ) { // Convert to array of TR elements var rows = []; var addRow = function ( r, k ) { // Recursion to allow for arrays of jQuery objects if ( $.isArray( r ) || r instanceof $ ) { for ( var i=0, ien=r.length ; i').addClass( k ); $('td', created) .addClass( k ) .html( r ) [0].colSpan = _fnVisbleColumns( ctx ); rows.push( created[0] ); } }; addRow( data, klass ); if ( row._details ) { row._details.remove(); } row._details = $(rows); // If the children were already shown, that state should be retained if ( row._detailsShow ) { row._details.insertAfter( row.nTr ); } }; var __details_remove = function ( api, idx ) { var ctx = api.context; if ( ctx.length ) { var row = ctx[0].aoData[ idx !== undefined ? idx : api[0] ]; if ( row && row._details ) { row._details.remove(); row._detailsShow = undefined; row._details = undefined; } } }; var __details_display = function ( api, show ) { var ctx = api.context; if ( ctx.length && api.length ) { var row = ctx[0].aoData[ api[0] ]; if ( row._details ) { row._detailsShow = show; if ( show ) { row._details.insertAfter( row.nTr ); } else { row._details.detach(); } __details_events( ctx[0] ); } } }; var __details_events = function ( settings ) { var api = new _Api( settings ); var namespace = '.dt.DT_details'; var drawEvent = 'draw'+namespace; var colvisEvent = 'column-visibility'+namespace; var destroyEvent = 'destroy'+namespace; var data = settings.aoData; api.off( drawEvent +' '+ colvisEvent +' '+ destroyEvent ); if ( _pluck( data, '_details' ).length > 0 ) { // On each draw, insert the required elements into the document api.on( drawEvent, function ( e, ctx ) { if ( settings !== ctx ) { return; } api.rows( {page:'current'} ).eq(0).each( function (idx) { // Internal data grab var row = data[ idx ]; if ( row._detailsShow ) { row._details.insertAfter( row.nTr ); } } ); } ); // Column visibility change - update the colspan api.on( colvisEvent, function ( e, ctx, idx, vis ) { if ( settings !== ctx ) { return; } // Update the colspan for the details rows (note, only if it already has // a colspan) var row, visible = _fnVisbleColumns( ctx ); for ( var i=0, ien=data.length ; i 0 ) { // Assign the first element to the first item in the instance // and truncate the instance and context inst[0] = inst[i]; inst[0].length = 1; inst.length = 1; inst.context = [ inst.context[i] ]; return inst; } } // Not found - return an empty instance inst.length = 0; return inst; }; var _selector_row_indexes = function ( settings, opts ) { var i, ien, tmp, a=[], displayFiltered = settings.aiDisplay, displayMaster = settings.aiDisplayMaster; var search = opts.search, // none, applied, removed order = opts.order, // applied, current, index (original - compatibility with 1.9) page = opts.page; // all, current if ( _fnDataSource( settings ) == 'ssp' ) { // In server-side processing mode, most options are irrelevant since // rows not shown don't exist and the index order is the applied order // Removed is a special case - for consistency just return an empty // array return search === 'removed' ? [] : _range( 0, displayMaster.length ); } else if ( page == 'current' ) { // Current page implies that order=current and fitler=applied, since it is // fairly senseless otherwise, regardless of what order and search actually // are for ( i=settings._iDisplayStart, ien=settings.fnDisplayEnd() ; i= 0 && search == 'applied') ) { a.push( i ); } } } } return a; }; DataTablesSrc-1.10.11/js/api/api.state.js000066400000000000000000000011621265711500300177420ustar00rootroot00000000000000/* * State API methods */ _api_register( 'state()', function () { return this.context.length ? this.context[0].oSavedState : null; } ); _api_register( 'state.clear()', function () { return this.iterator( 'table', function ( settings ) { // Save an empty object settings.fnStateSaveCallback.call( settings.oInstance, settings, {} ); } ); } ); _api_register( 'state.loaded()', function () { return this.context.length ? this.context[0].oLoadedState : null; } ); _api_register( 'state.save()', function () { return this.iterator( 'table', function ( settings ) { _fnSaveState( settings ); } ); } ); DataTablesSrc-1.10.11/js/api/api.static.js000066400000000000000000000102511265711500300201100ustar00rootroot00000000000000 /** * Provide a common method for plug-ins to check the version of DataTables being * used, in order to ensure compatibility. * * @param {string} version Version string to check for, in the format "X.Y.Z". * Note that the formats "X" and "X.Y" are also acceptable. * @returns {boolean} true if this version of DataTables is greater or equal to * the required version, or false if this version of DataTales is not * suitable * @static * @dtopt API-Static * * @example * alert( $.fn.dataTable.versionCheck( '1.9.0' ) ); */ DataTable.versionCheck = DataTable.fnVersionCheck = function( version ) { var aThis = DataTable.version.split('.'); var aThat = version.split('.'); var iThis, iThat; for ( var i=0, iLen=aThat.length ; i iThat; } return true; }; /** * Check if a `` node is a DataTable table already or not. * * @param {node|jquery|string} table Table node, jQuery object or jQuery * selector for the table to test. Note that if more than more than one * table is passed on, only the first will be checked * @returns {boolean} true the table given is a DataTable, or false otherwise * @static * @dtopt API-Static * * @example * if ( ! $.fn.DataTable.isDataTable( '#example' ) ) { * $('#example').dataTable(); * } */ DataTable.isDataTable = DataTable.fnIsDataTable = function ( table ) { var t = $(table).get(0); var is = false; $.each( DataTable.settings, function (i, o) { var head = o.nScrollHead ? $('table', o.nScrollHead)[0] : null; var foot = o.nScrollFoot ? $('table', o.nScrollFoot)[0] : null; if ( o.nTable === t || head === t || foot === t ) { is = true; } } ); return is; }; /** * Get all DataTable tables that have been initialised - optionally you can * select to get only currently visible tables. * * @param {boolean} [visible=false] Flag to indicate if you want all (default) * or visible tables only. * @returns {array} Array of `table` nodes (not DataTable instances) which are * DataTables * @static * @dtopt API-Static * * @example * $.each( $.fn.dataTable.tables(true), function () { * $(table).DataTable().columns.adjust(); * } ); */ DataTable.tables = DataTable.fnTables = function ( visible ) { var api = false; if ( $.isPlainObject( visible ) ) { api = visible.api; visible = visible.visible; } var a = $.map( DataTable.settings, function (o) { if ( !visible || (visible && $(o.nTable).is(':visible')) ) { return o.nTable; } } ); return api ? new _Api( a ) : a; }; /** * DataTables utility methods * * This namespace provides helper methods that DataTables uses internally to * create a DataTable, but which are not exclusively used only for DataTables. * These methods can be used by extension authors to save the duplication of * code. * * @namespace */ DataTable.util = { /** * Throttle the calls to a function. Arguments and context are maintained * for the throttled function. * * @param {function} fn Function to be called * @param {integer} freq Call frequency in mS * @return {function} Wrapped function */ throttle: _fnThrottle, /** * Escape a string such that it can be used in a regular expression * * @param {string} sVal string to escape * @returns {string} escaped string */ escapeRegex: _fnEscapeRegex }; /** * Convert from camel case parameters to Hungarian notation. This is made public * for the extensions to provide the same ability as DataTables core to accept * either the 1.9 style Hungarian notation, or the 1.10+ style camelCase * parameters. * * @param {object} src The model object which holds all parameters that can be * mapped. * @param {object} user The object to convert from camel case to Hungarian. * @param {boolean} force When set to `true`, properties which already have a * Hungarian value in the `user` object will be overwritten. Otherwise they * won't be. */ DataTable.camelToHungarian = _fnCamelToHungarian; DataTablesSrc-1.10.11/js/api/api.table.js000066400000000000000000000050101265711500300177050ustar00rootroot00000000000000 /** * Selector for HTML tables. Apply the given selector to the give array of * DataTables settings objects. * * @param {string|integer} [selector] jQuery selector string or integer * @param {array} Array of DataTables settings objects to be filtered * @return {array} * @ignore */ var __table_selector = function ( selector, a ) { // Integer is used to pick out a table by index if ( typeof selector === 'number' ) { return [ a[ selector ] ]; } // Perform a jQuery selector on the table nodes var nodes = $.map( a, function (el, i) { return el.nTable; } ); return $(nodes) .filter( selector ) .map( function (i) { // Need to translate back from the table node to the settings var idx = $.inArray( this, nodes ); return a[ idx ]; } ) .toArray(); }; /** * Context selector for the API's context (i.e. the tables the API instance * refers to. * * @name DataTable.Api#tables * @param {string|integer} [selector] Selector to pick which tables the iterator * should operate on. If not given, all tables in the current context are * used. This can be given as a jQuery selector (for example `':gt(0)'`) to * select multiple tables or as an integer to select a single table. * @returns {DataTable.Api} Returns a new API instance if a selector is given. */ _api_register( 'tables()', function ( selector ) { // A new instance is created if there was a selector specified return selector ? new _Api( __table_selector( selector, this.context ) ) : this; } ); _api_register( 'table()', function ( selector ) { var tables = this.tables( selector ); var ctx = tables.context; // Truncate to the first matched table return ctx.length ? new _Api( ctx[0] ) : tables; } ); _api_registerPlural( 'tables().nodes()', 'table().node()' , function () { return this.iterator( 'table', function ( ctx ) { return ctx.nTable; }, 1 ); } ); _api_registerPlural( 'tables().body()', 'table().body()' , function () { return this.iterator( 'table', function ( ctx ) { return ctx.nTBody; }, 1 ); } ); _api_registerPlural( 'tables().header()', 'table().header()' , function () { return this.iterator( 'table', function ( ctx ) { return ctx.nTHead; }, 1 ); } ); _api_registerPlural( 'tables().footer()', 'table().footer()' , function () { return this.iterator( 'table', function ( ctx ) { return ctx.nTFoot; }, 1 ); } ); _api_registerPlural( 'tables().containers()', 'table().container()' , function () { return this.iterator( 'table', function ( ctx ) { return ctx.nTableWrapper; }, 1 ); } ); DataTablesSrc-1.10.11/js/core/000077500000000000000000000000001265711500300156735ustar00rootroot00000000000000DataTablesSrc-1.10.11/js/core/core.ajax.js000066400000000000000000000231651265711500300201120ustar00rootroot00000000000000/** * Create an Ajax call based on the table's settings, taking into account that * parameters can have multiple forms, and backwards compatibility. * * @param {object} oSettings dataTables settings object * @param {array} data Data to send to the server, required by * DataTables - may be augmented by developer callbacks * @param {function} fn Callback function to run when data is obtained */ function _fnBuildAjax( oSettings, data, fn ) { // Compatibility with 1.9-, allow fnServerData and event to manipulate _fnCallbackFire( oSettings, 'aoServerParams', 'serverParams', [data] ); // Convert to object based for 1.10+ if using the old array scheme which can // come from server-side processing or serverParams if ( data && $.isArray(data) ) { var tmp = {}; var rbracket = /(.*?)\[\]$/; $.each( data, function (key, val) { var match = val.name.match(rbracket); if ( match ) { // Support for arrays var name = match[0]; if ( ! tmp[ name ] ) { tmp[ name ] = []; } tmp[ name ].push( val.value ); } else { tmp[val.name] = val.value; } } ); data = tmp; } var ajaxData; var ajax = oSettings.ajax; var instance = oSettings.oInstance; var callback = function ( json ) { _fnCallbackFire( oSettings, null, 'xhr', [oSettings, json, oSettings.jqXHR] ); fn( json ); }; if ( $.isPlainObject( ajax ) && ajax.data ) { ajaxData = ajax.data; var newData = $.isFunction( ajaxData ) ? ajaxData( data, oSettings ) : // fn can manipulate data or return ajaxData; // an object object or array to merge // If the function returned something, use that alone data = $.isFunction( ajaxData ) && newData ? newData : $.extend( true, data, newData ); // Remove the data property as we've resolved it already and don't want // jQuery to do it again (it is restored at the end of the function) delete ajax.data; } var baseAjax = { "data": data, "success": function (json) { var error = json.error || json.sError; if ( error ) { _fnLog( oSettings, 0, error ); } oSettings.json = json; callback( json ); }, "dataType": "json", "cache": false, "type": oSettings.sServerMethod, "error": function (xhr, error, thrown) { var ret = _fnCallbackFire( oSettings, null, 'xhr', [oSettings, null, oSettings.jqXHR] ); if ( $.inArray( true, ret ) === -1 ) { if ( error == "parsererror" ) { _fnLog( oSettings, 0, 'Invalid JSON response', 1 ); } else if ( xhr.readyState === 4 ) { _fnLog( oSettings, 0, 'Ajax error', 7 ); } } _fnProcessingDisplay( oSettings, false ); } }; // Store the data submitted for the API oSettings.oAjaxData = data; // Allow plug-ins and external processes to modify the data _fnCallbackFire( oSettings, null, 'preXhr', [oSettings, data] ); if ( oSettings.fnServerData ) { // DataTables 1.9- compatibility oSettings.fnServerData.call( instance, oSettings.sAjaxSource, $.map( data, function (val, key) { // Need to convert back to 1.9 trad format return { name: key, value: val }; } ), callback, oSettings ); } else if ( oSettings.sAjaxSource || typeof ajax === 'string' ) { // DataTables 1.9- compatibility oSettings.jqXHR = $.ajax( $.extend( baseAjax, { url: ajax || oSettings.sAjaxSource } ) ); } else if ( $.isFunction( ajax ) ) { // Is a function - let the caller define what needs to be done oSettings.jqXHR = ajax.call( instance, data, callback, oSettings ); } else { // Object to extend the base settings oSettings.jqXHR = $.ajax( $.extend( baseAjax, ajax ) ); // Restore for next time around ajax.data = ajaxData; } } /** * Update the table using an Ajax call * @param {object} settings dataTables settings object * @returns {boolean} Block the table drawing or not * @memberof DataTable#oApi */ function _fnAjaxUpdate( settings ) { if ( settings.bAjaxDataGet ) { settings.iDraw++; _fnProcessingDisplay( settings, true ); _fnBuildAjax( settings, _fnAjaxParameters( settings ), function(json) { _fnAjaxUpdateDraw( settings, json ); } ); return false; } return true; } /** * Build up the parameters in an object needed for a server-side processing * request. Note that this is basically done twice, is different ways - a modern * method which is used by default in DataTables 1.10 which uses objects and * arrays, or the 1.9- method with is name / value pairs. 1.9 method is used if * the sAjaxSource option is used in the initialisation, or the legacyAjax * option is set. * @param {object} oSettings dataTables settings object * @returns {bool} block the table drawing or not * @memberof DataTable#oApi */ function _fnAjaxParameters( settings ) { var columns = settings.aoColumns, columnCount = columns.length, features = settings.oFeatures, preSearch = settings.oPreviousSearch, preColSearch = settings.aoPreSearchCols, i, data = [], dataProp, column, columnSearch, sort = _fnSortFlatten( settings ), displayStart = settings._iDisplayStart, displayLength = features.bPaginate !== false ? settings._iDisplayLength : -1; var param = function ( name, value ) { data.push( { 'name': name, 'value': value } ); }; // DataTables 1.9- compatible method param( 'sEcho', settings.iDraw ); param( 'iColumns', columnCount ); param( 'sColumns', _pluck( columns, 'sName' ).join(',') ); param( 'iDisplayStart', displayStart ); param( 'iDisplayLength', displayLength ); // DataTables 1.10+ method var d = { draw: settings.iDraw, columns: [], order: [], start: displayStart, length: displayLength, search: { value: preSearch.sSearch, regex: preSearch.bRegex } }; for ( i=0 ; i').appendTo(this); } oSettings.nTBody = tbody[0]; var tfoot = $this.children('tfoot'); if ( tfoot.length === 0 && captions.length > 0 && (oSettings.oScroll.sX !== "" || oSettings.oScroll.sY !== "") ) { // If we are a scrolling table, and no footer has been given, then we need to create // a tfoot element for the caption element to be appended to tfoot = $('').appendTo(this); } if ( tfoot.length === 0 || tfoot.children().length === 0 ) { $this.addClass( oClasses.sNoFooter ); } else if ( tfoot.length > 0 ) { oSettings.nTFoot = tfoot[0]; _fnDetectHeader( oSettings.aoFooter, oSettings.nTFoot ); } /* Check if there is data passing into the constructor */ if ( oInit.aaData ) { for ( i=0 ; i=0 if successful (index of new aoData entry), -1 if failed * @memberof DataTable#oApi */ function _fnAddData ( oSettings, aDataIn, nTr, anTds ) { /* Create the object for storing information about this new row */ var iRow = oSettings.aoData.length; var oData = $.extend( true, {}, DataTable.models.oRow, { src: nTr ? 'dom' : 'data', idx: iRow } ); oData._aData = aDataIn; oSettings.aoData.push( oData ); /* Create the cells */ var nTd, sThisType; var columns = oSettings.aoColumns; // Invalidate the column types as the new data needs to be revalidated for ( var i=0, iLen=columns.length ; i iTarget ) { a[i]--; } } if ( iTargetIndex != -1 && splice === undefined ) { a.splice( iTargetIndex, 1 ); } } /** * Mark cached data as invalid such that a re-read of the data will occur when * the cached data is next requested. Also update from the data source object. * * @param {object} settings DataTables settings object * @param {int} rowIdx Row index to invalidate * @param {string} [src] Source to invalidate from: undefined, 'auto', 'dom' * or 'data' * @param {int} [colIdx] Column index to invalidate. If undefined the whole * row will be invalidated * @memberof DataTable#oApi * * @todo For the modularisation of v1.11 this will need to become a callback, so * the sort and filter methods can subscribe to it. That will required * initialisation options for sorting, which is why it is not already baked in */ function _fnInvalidate( settings, rowIdx, src, colIdx ) { var row = settings.aoData[ rowIdx ]; var i, ien; var cellWrite = function ( cell, col ) { // This is very frustrating, but in IE if you just write directly // to innerHTML, and elements that are overwritten are GC'ed, // even if there is a reference to them elsewhere while ( cell.childNodes.length ) { cell.removeChild( cell.firstChild ); } cell.innerHTML = _fnGetCellData( settings, rowIdx, col, 'display' ); }; // Are we reading last data from DOM or the data object? if ( src === 'dom' || ((! src || src === 'auto') && row.src === 'dom') ) { // Read the data from the DOM row._aData = _fnGetRowElements( settings, row, colIdx, colIdx === undefined ? undefined : row._aData ) .data; } else { // Reading from data object, update the DOM var cells = row.anCells; if ( cells ) { if ( colIdx !== undefined ) { cellWrite( cells[colIdx], colIdx ); } else { for ( i=0, ien=cells.length ; i').appendTo( thead ); } for ( i=0, ien=columns.length ; itr').attr('role', 'row'); /* Deal with the footer - add classes if required */ $(thead).find('>tr>th, >tr>td').addClass( classes.sHeaderTH ); $(tfoot).find('>tr>th, >tr>td').addClass( classes.sFooterTH ); // Cache the footer cells. Note that we only take the cells from the first // row in the footer. If there is more than one row the user wants to // interact with, they need to use the table().foot() method. Note also this // allows cells to be used for multiple columns using colspan if ( tfoot !== null ) { var cells = oSettings.aoFooter[0]; for ( i=0, ien=cells.length ; i' ); $('#example thead tr').append( '' ); $('#example thead tr').append( '' ); $('#example thead tr').append( '' ); $('#example thead tr').append( '' ); var aDataSet = [ [ "1", "홍길동", "1154315", "etc1", [ [ "test1@daum.net", "2011-03-04" ], [ "test1@naver.com", "2009-07-06" ], [ "test4@naver.com", ",hide" ], [ "test5?@naver.com", "" ] ], "2011-03-04", "show" ], [ "2", "홍길순", "2154315", "etc2", [ [ "test2@daum.net", "2009-09-26" ], [ "test2@naver.com", "2009-05-21,hide" ], [ "lsb@naver.com", "2010-03-05" ], [ "lsb3@naver.com", ",hide" ], [ "sooboklee9@daum.net", "2010-03-05" ] ], "2010-03-05", "show" ] ] var oTable = $('#example').dataTable({ "aaData": aDataSet, "aoColumns": [ { "mData": "0"}, { "mData": "1"}, { "mData": "2"}, { "mData": "3"}, { "mData": "4.0.0"}, { "mData": "4.0.1"}, { "mData": "4.1.0"}, { "mData": "4.1.1"}, { "mData": "5"}, { "mData": "6"} ] }); oTest.fnTest( "Initialisation", null, function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == '1'; } ); oTest.fnTest( "Update row", function () { $('#example').dataTable().fnUpdate( [ "0", "홍길순", "2154315", "etc2", [ [ "test2@daum.net", "2009-09-26" ], [ "test2@naver.com", "2009-05-21,hide" ], [ "lsb@naver.com", "2010-03-05" ], [ "lsb3@naver.com", ",hide" ], [ "sooboklee9@daum.net", "2010-03-05" ] ], "2010-03-05", "show" ], 1 ); }, function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == '0'; } ); oTest.fnTest( "Original row preserved", null, function () { return $('#example tbody tr:eq(1) td:eq(0)').html() == '1'; } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/1_dom/5396-fnUpdate-arrays.js000077500000000000000000000046131265711500300252130ustar00rootroot00000000000000// DATA_TEMPLATE: empty_table oTest.fnStart( "5396 - fnUpdate with 2D arrays for a single row" ); $(document).ready( function () { $('#example thead tr').append( '' ); $('#example thead tr').append( '' ); $('#example thead tr').append( '' ); $('#example thead tr').append( '' ); $('#example thead tr').append( '' ); var aDataSet = [ [ "1", "홍길동", "1154315", "etc1", [ [ "test1@daum.net", "2011-03-04" ], [ "test1@naver.com", "2009-07-06" ], [ "test4@naver.com", ",hide" ], [ "test5?@naver.com", "" ] ], "2011-03-04", "show" ], [ "2", "홍길순", "2154315", "etc2", [ [ "test2@daum.net", "2009-09-26" ], [ "test2@naver.com", "2009-05-21,hide" ], [ "lsb@naver.com", "2010-03-05" ], [ "lsb3@naver.com", ",hide" ], [ "sooboklee9@daum.net", "2010-03-05" ] ], "2010-03-05", "show" ] ] var oTable = $('#example').dataTable({ "aaData": aDataSet, "aoColumns": [ { "mDataProp": "0"}, { "mDataProp": "1"}, { "mDataProp": "2"}, { "mDataProp": "3"}, { "mDataProp": "4.0.0"}, { "mDataProp": "4.0.1"}, { "mDataProp": "4.1.0"}, { "mDataProp": "4.1.1"}, { "mDataProp": "5"}, { "mDataProp": "6"} ] }); oTest.fnTest( "Initialisation", null, function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == '1'; } ); oTest.fnTest( "Update row", function () { $('#example').dataTable().fnUpdate( [ "0", "홍길순", "2154315", "etc2", [ [ "test2@daum.net", "2009-09-26" ], [ "test2@naver.com", "2009-05-21,hide" ], [ "lsb@naver.com", "2010-03-05" ], [ "lsb3@naver.com", ",hide" ], [ "sooboklee9@daum.net", "2010-03-05" ] ], "2010-03-05", "show" ], 1 ); }, function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == '0'; } ); oTest.fnTest( "Original row preserved", null, function () { return $('#example tbody tr:eq(1) td:eq(0)').html() == '1'; } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/1_dom/5508-xscroll-zero-content.js000077500000000000000000000011471265711500300262530ustar00rootroot00000000000000// DATA_TEMPLATE: dom_data oTest.fnStart( "5508 - Table container width doesn't change when filtering applied to scrolling table" ); $(document).ready( function () { $('#example').dataTable( { "sScrollY": "300px", "bPaginate": false } ); oTest.fnTest( "Width of container 800px on init with scroll", null, function () { return $('div.dataTables_scrollBody').width() == 800; } ); oTest.fnTest( "Unaltered when filter applied", function () { $('#example').dataTable().fnFilter('123'); }, function () { return $('div.dataTables_scrollBody').width() == 800; } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/1_dom/6776-scrolling-table-grows.js000077500000000000000000000034431265711500300263710ustar00rootroot00000000000000// DATA_TEMPLATE: 6776 oTest.fnStart( "Actions on a scrolling table keep width" ); $(document).ready( function () { var oTable = $('#example').dataTable( { "bFilter": true, "bSort": true, "sScrollY": "100px", "bPaginate": false } ); var iWidth = $('div.dataTables_wrapper').width(); oTest.fnTest( "First sort has no effect on width", function () { $('th:eq(1)').click(); }, function () { return $('div.dataTables_wrapper').width() == iWidth; } ); oTest.fnTest( "Second sort has no effect on width", function () { $('th:eq(1)').click(); }, function () { return $('div.dataTables_wrapper').width() == iWidth; } ); oTest.fnTest( "Third sort has no effect on width", function () { $('th:eq(2)').click(); }, function () { return $('div.dataTables_wrapper').width() == iWidth; } ); oTest.fnTest( "Filter has no effect on width", function () { oTable.fnFilter('i'); }, function () { return $('div.dataTables_wrapper').width() == iWidth; } ); oTest.fnTest( "Filter 2 has no effect on width", function () { oTable.fnFilter('in'); }, function () { return $('div.dataTables_wrapper').width() == iWidth; } ); oTest.fnTest( "No result filter has header and body at same width", function () { oTable.fnFilter('xxx'); }, function () { return $('#example').width() == $('div.dataTables_scrollHeadInner').width(); } ); oTest.fnTest( "Filter with no results has no effect on width", function () { oTable.fnFilter('xxx'); }, function () { return $('div.dataTables_wrapper').width() == iWidth; } ); oTest.fnTest( "Filter with no results has table equal to wrapper width", function () { oTable.fnFilter('xxx'); }, function () { return $('div.dataTables_wrapper').width() == $('#example').width(); } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/1_dom/_getDataFunctions.js000077500000000000000000000173271265711500300251510ustar00rootroot00000000000000// DATA_TEMPLATE: dom_data oTest.fnStart( "Check behaviour of the data get functions that DataTables uses" ); $(document).ready( function () { // Slightly unusual test set this one, in that we don't really care about the DOM // but want to test the internal data handling functions but we do need a table to // get at the functions! var table = $('#example').dataTable(); var fn, test; // Object property access oTest.fnTest( "Single object, single property", function () { fn = table.oApi._fnGetObjectDataFn('test'); test = fn( { "test": true } ); }, function () { return test } ); oTest.fnTest( "Single property from object", function () { fn = table.oApi._fnGetObjectDataFn('test'); test = fn( { "test": true, "test2": false } ); }, function () { return test } ); oTest.fnTest( "Single property from object - different property", function () { fn = table.oApi._fnGetObjectDataFn('test2'); test = fn( { "test": true, "test2": false } ); }, function () { return test===false } ); oTest.fnTest( "Undefined property from object", function () { fn = table.oApi._fnGetObjectDataFn('test3'); test = fn( { "test": true, "test2": false } ); }, function () { return test===undefined } ); // Array index access oTest.fnTest( "Array access - index 0", function () { fn = table.oApi._fnGetObjectDataFn(0); test = fn( [true, false, false, false] ); }, function () { return test } ); oTest.fnTest( "Array access - index 1", function () { fn = table.oApi._fnGetObjectDataFn(2); test = fn( [false, false, true, false] ); }, function () { return test } ); oTest.fnTest( "Array access - undefined", function () { fn = table.oApi._fnGetObjectDataFn(7); test = fn( [false, false, true, false] ); }, function () { return test===undefined } ); // null source oTest.fnTest( "null source", function () { fn = table.oApi._fnGetObjectDataFn( null ); tmp = [false, false, true, false]; test = fn( tmp ); }, function () { return test===tmp } ); // nested objects oTest.fnTest( "Nested object property", function () { fn = table.oApi._fnGetObjectDataFn( 'a.b' ); test = fn( { "a":{ "b": true, "c": false, "d": 1 } } ); }, function () { return test } ); oTest.fnTest( "Nested object property - different prop", function () { fn = table.oApi._fnGetObjectDataFn( 'a.d' ); test = fn( { "a":{ "b": true, "c": false, "d": 1 } } ); }, function () { return test===1 } ); oTest.fnTest( "Nested object property - undefined prop", function () { fn = table.oApi._fnGetObjectDataFn( 'a.z' ); test = fn( { "a":{ "b": true, "c": false, "d": 1 } } ); }, function () { return test===undefined } ); // Nested array oTest.fnTest( "Nested array index property", function () { fn = table.oApi._fnGetObjectDataFn( 'a.0' ); test = fn( { "a": [ true, false, 1 ] } ); }, function () { return test } ); oTest.fnTest( "Nested array index property - different index", function () { fn = table.oApi._fnGetObjectDataFn( 'a.2' ); test = fn( { "a": [ true, false, 1 ] } ); }, function () { return test===1 } ); oTest.fnTest( "Nested array index property - undefined index", function () { fn = table.oApi._fnGetObjectDataFn( 'a.10' ); test = fn( { "a": [ true, false, 1 ] } ); }, function () { return test===undefined } ); // Nested array object property oTest.fnTest( "Nested array index object property", function () { fn = table.oApi._fnGetObjectDataFn( 'a.0.m' ); test = fn( { "a": [ { "m": true, "n": 1 }, { "m": false, "n": 2 }, { "m": false, "n": 3 } ] } ); }, function () { return test } ); oTest.fnTest( "Nested array index object property - different index", function () { fn = table.oApi._fnGetObjectDataFn( 'a.2.n' ); test = fn( { "a": [ { "m": true, "n": 1 }, { "m": false, "n": 2 }, { "m": false, "n": 3 } ] } ); }, function () { return test===3 } ); oTest.fnTest( "Nested array index object property - undefined index", function () { fn = table.oApi._fnGetObjectDataFn( 'a.0.z' ); test = fn( { "a": [ { "m": true, "n": 1 }, { "m": false, "n": 2 }, { "m": false, "n": 3 } ] } ); }, function () { return test===undefined } ); // Array notation - no join oTest.fnTest( "Array notation - no join - property", function () { fn = table.oApi._fnGetObjectDataFn( 'a[].n' ); test = fn( { "a": [ { "m": true, "n": 1 }, { "m": false, "n": 2 }, { "m": false, "n": 3 } ] } ); }, function () { return test.length===3 && test[0]===1 && test[1]===2 && test[2]===3; } ); oTest.fnTest( "Array notation - no join - property (2)", function () { fn = table.oApi._fnGetObjectDataFn( 'a[].m' ); test = fn( { "a": [ { "m": true, "n": 1 }, { "m": false, "n": 2 } ] } ); }, function () { return test.length===2 && test[0]===true && test[1]===false; } ); oTest.fnTest( "Array notation - no join - undefined property", function () { fn = table.oApi._fnGetObjectDataFn( 'a[].z' ); test = fn( { "a": [ { "m": true, "n": 1 }, { "m": false, "n": 2 } ] } ); }, function () { return test.length===2 && test[0]===undefined && test[1]===undefined; } ); // Array notation - join oTest.fnTest( "Array notation - space join - property", function () { fn = table.oApi._fnGetObjectDataFn( 'a[ ].n' ); test = fn( { "a": [ { "m": true, "n": 1 }, { "m": false, "n": 2 }, { "m": false, "n": 3 } ] } ); }, function () { return test === '1 2 3'; } ); oTest.fnTest( "Array notation - space join - property (2)", function () { fn = table.oApi._fnGetObjectDataFn( 'a[ ].m' ); test = fn( { "a": [ { "m": true, "n": 1 }, { "m": false, "n": 2 } ] } ); }, function () { return test === 'true false'; } ); oTest.fnTest( "Array notation - sapce join - undefined property", function () { fn = table.oApi._fnGetObjectDataFn( 'a[ ].z' ); test = fn( { "a": [ { "m": true, "n": 1 }, { "m": false, "n": 2 } ] } ); }, function () { return test === ' '; } ); oTest.fnTest( "Array notation - string join - property", function () { fn = table.oApi._fnGetObjectDataFn( 'a[qwerty].n' ); test = fn( { "a": [ { "m": true, "n": 1 }, { "m": false, "n": 2 }, { "m": false, "n": 3 } ] } ); }, function () { return test === '1qwerty2qwerty3'; } ); oTest.fnTest( "Array notation - string join - property (2)", function () { fn = table.oApi._fnGetObjectDataFn( 'a[qwerty].m' ); test = fn( { "a": [ { "m": true, "n": 1 }, { "m": false, "n": 2 } ] } ); }, function () { return test === 'trueqwertyfalse'; } ); // Array alone join oTest.fnTest( "Flat array join", function () { fn = table.oApi._fnGetObjectDataFn( 'a[ ]' ); test = fn( { "a": [ true, false, 1 ] } ); }, function () { return test==="true false 1"; } ); oTest.fnTest( "Flat array string join", function () { fn = table.oApi._fnGetObjectDataFn( 'a[qwerty]' ); test = fn( { "a": [ true, false, 1 ] } ); }, function () { return test==="trueqwertyfalseqwerty1"; } ); oTest.fnTest( "Flat array no join", function () { fn = table.oApi._fnGetObjectDataFn( 'a[]' ); test = fn( { "a": [ true, false, 1 ] } ); }, function () { return test.length===3 && test[0]===true && test[1]===false && test[2]===1; } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/1_dom/_setDataFunctions.js000066400000000000000000000072311265711500300251530ustar00rootroot00000000000000// DATA_TEMPLATE: dom_data oTest.fnStart( "Check behaviour of the data set functions that DataTables uses" ); $(document).ready( function () { // Slightly unusual test set this one, in that we don't really care about the DOM // but want to test the internal data handling functions but we do need a table to // get at the functions! var table = $('#example').dataTable(); var fn, test, o; // Object property access oTest.fnTest( "Create property", function () { fn = table.oApi._fnSetObjectDataFn('test'); o = {}; fn( o, true ); }, function () { return o.test } ); oTest.fnTest( "Single property doesn't kill other properties", function () { fn = table.oApi._fnSetObjectDataFn('test'); o = { "test2": false }; fn( o, true ); }, function () { return o.test && o.test2===false; } ); oTest.fnTest( "Single property overwrite old property", function () { fn = table.oApi._fnSetObjectDataFn('test'); o = { "test": false, "test2": false }; fn( o, true ); }, function () { return o.test && o.test2===false; } ); // Nested oTest.fnTest( "Create nested property", function () { fn = table.oApi._fnSetObjectDataFn('test.inner'); o = { "test": {} }; fn( o, true ); }, function () { return o.test.inner } ); oTest.fnTest( "Deep create nested property", function () { fn = table.oApi._fnSetObjectDataFn('test.inner'); o = {}; fn( o, true ); }, function () { return o.test.inner } ); oTest.fnTest( "Nested property doesn't kill other properties", function () { fn = table.oApi._fnSetObjectDataFn('test.inner'); o = { "test": { "test2": false } }; fn( o, true ); }, function () { return o.test.inner && o.test.test2===false; } ); oTest.fnTest( "Single property overwrite old property", function () { fn = table.oApi._fnSetObjectDataFn('nested.test'); o = { "nested": { "test": false, "test2": false } }; fn( o, true ); }, function () { return o.nested.test && o.nested.test2===false; } ); // Set arrays / objects oTest.fnTest( "Create object", function () { fn = table.oApi._fnSetObjectDataFn('test'); o = {}; fn( o, {"a":true, "b":false} ); }, function () { return o.test.a && o.test.b===false } ); oTest.fnTest( "Create nested object", function () { fn = table.oApi._fnSetObjectDataFn('nested.test'); o = {}; fn( o, {"a":true, "b":false} ); }, function () { return o.nested.test.a && o.nested.test.b===false } ); oTest.fnTest( "Create array", function () { fn = table.oApi._fnSetObjectDataFn('test'); o = {}; fn( o, [1,2,3] ); }, function () { return o.test[0]===1 && o.test[2]===3 } ); oTest.fnTest( "Create nested array", function () { fn = table.oApi._fnSetObjectDataFn('nested.test'); o = {}; fn( o, [1,2,3] ); }, function () { return o.nested.test[0]===1 && o.nested.test[2]===3 } ); // Array notation oTest.fnTest( "Create array of objects", function () { fn = table.oApi._fnSetObjectDataFn('test[].a'); o = {}; fn( o, [1,2,3] ); }, function () { return o.test.length===3 && o.test[0].a===1 && o.test[1].a===2; } ); oTest.fnTest( "Create array of nested objects", function () { fn = table.oApi._fnSetObjectDataFn('test[].a.b'); o = {}; fn( o, [1,2,3] ); }, function () { return o.test.length===3 && o.test[0].a.b===1 && o.test[1].a.b===2; } ); oTest.fnTest( "Create array", function () { fn = table.oApi._fnSetObjectDataFn('test[]'); o = {}; fn( o, [1,2,3] ); }, function () { return o.test.length===3 && o.test[0]===1 && o.test[1]===2; } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/1_dom/_zero_config.js000077500000000000000000000320231265711500300242010ustar00rootroot00000000000000// DATA_TEMPLATE: dom_data oTest.fnStart( "Sanity checks for DataTables with DOM data" ); oTest.fnTest( "jQuery.dataTable function", null, function () { return typeof jQuery().dataTable == "function"; } ); oTest.fnTest( "jQuery.dataTableSettings storage array", null, function () { return typeof jQuery().dataTableSettings == "object"; } ); oTest.fnTest( "jQuery.dataTableExt plugin object", null, function () { return typeof jQuery().dataTableExt == "object"; } ); $(document).ready( function () { $('#example').dataTable(); /* Basic checks */ oTest.fnTest( "Length changing div exists", null, function () { return document.getElementById('example_length') != null; } ); oTest.fnTest( "Filtering div exists", null, function () { return document.getElementById('example_filter') != null; } ); oTest.fnTest( "Information div exists", null, function () { return document.getElementById('example_info') != null; } ); oTest.fnTest( "Pagination div exists", null, function () { return document.getElementById('example_paginate') != null; } ); oTest.fnTest( "Processing div is off by default", null, function () { return document.getElementById('example_processing') == null; } ); oTest.fnTest( "10 rows shown on the first page", null, function () { return $('#example tbody tr').length == 10; } ); oTest.fnTest( "Initial sort occured", null, function () { return $('#example tbody td:eq(0)').html() == "Gecko"; } ); /* Need to use the WaitTest for sorting due to the setTimeout datatables uses */ oTest.fnTest( "Sorting (first click) on second column", function () { $('#example thead th:eq(1)').click(); }, function () { return $('#example tbody td:eq(1)').html() == "All others"; } ); oTest.fnTest( "Sorting (second click) on second column", function () { $('#example thead th:eq(1)').click(); }, function () { return $('#example tbody td:eq(1)').html() == "Seamonkey 1.1"; } ); oTest.fnTest( "Sorting (third click) on second column", function () { $('#example thead th:eq(1)').click(); }, function () { return $('#example tbody td:eq(1)').html() == "All others"; } ); oTest.fnTest( "Sorting (first click) on numeric column", function () { $('#example thead th:eq(3)').click(); }, function () { return $('#example tbody td:eq(3)').html() == "-"; } ); oTest.fnTest( "Sorting (second click) on numeric column", function () { $('#example thead th:eq(3)').click(); }, function () { return $('#example tbody td:eq(3)').html() == "522.1"; } ); oTest.fnTest( "Sorting multi-column (first click)", function () { $('#example thead th:eq(0)').click(); oDispacher.click( $('#example thead th:eq(1)')[0], { 'shift': true } ); }, function () { var b = $('#example tbody td:eq(0)').html() == "Gecko" && $('#example tbody td:eq(1)').html() == "Camino 1.0"; return b; } ); oTest.fnTest( "Sorting multi-column - sorting second column only", function () { $('#example thead th:eq(1)').click(); }, function () { return $('#example tbody td:eq(1)').html() == "All others"; } ); /* Basic paging */ oTest.fnTest( "Paging to second page", function () { $('#example_next').click(); }, function () { return $('#example tbody td:eq(1)').html() == "IE Mobile"; } ); oTest.fnTest( "Paging to first page", function () { $('#example_previous').click(); }, function () { return $('#example tbody td:eq(1)').html() == "All others"; } ); oTest.fnTest( "Attempting to page back beyond the first page", function () { $('#example_previous').click(); }, function () { return $('#example tbody td:eq(1)').html() == "All others"; } ); /* Changing length */ oTest.fnTest( "Changing table length to 25 records", function () { $("select[name=example_length]").val('25').change(); }, function () { return $('#example tbody tr').length == 25; } ); oTest.fnTest( "Changing table length to 50 records", function () { $("select[name=example_length]").val('50').change(); }, function () { return $('#example tbody tr').length == 50; } ); oTest.fnTest( "Changing table length to 100 records", function () { $("select[name=example_length]").val('100').change(); }, function () { return $('#example tbody tr').length == 57; } ); oTest.fnTest( "Changing table length to 10 records", function () { $("select[name=example_length]").val('10').change(); }, function () { return $('#example tbody tr').length == 10; } ); /* * Information element */ oTest.fnTest( "Information on zero config", null, function () { return document.getElementById('example_info').innerHTML == "Showing 1 to 10 of 57 entries"; } ); oTest.fnTest( "Information on second page", function () { $('#example_next').click(); }, function () { return document.getElementById('example_info').innerHTML == "Showing 11 to 20 of 57 entries"; } ); oTest.fnTest( "Information on third page", function () { $('#example_next').click(); }, function () { return document.getElementById('example_info').innerHTML == "Showing 21 to 30 of 57 entries"; } ); oTest.fnTest( "Information on last page", function () { $('#example_next').click(); $('#example_next').click(); $('#example_next').click(); }, function () { return document.getElementById('example_info').innerHTML == "Showing 51 to 57 of 57 entries"; } ); oTest.fnTest( "Information back on first page", function () { $('#example_previous').click(); $('#example_previous').click(); $('#example_previous').click(); $('#example_previous').click(); $('#example_previous').click(); }, function () { return document.getElementById('example_info').innerHTML == "Showing 1 to 10 of 57 entries"; } ); oTest.fnTest( "Information with 25 records", function () { $("select[name=example_length]").val('25').change(); }, function () { return document.getElementById('example_info').innerHTML == "Showing 1 to 25 of 57 entries"; } ); oTest.fnTest( "Information with 25 records - second page", function () { $('#example_next').click(); }, function () { return document.getElementById('example_info').innerHTML == "Showing 26 to 50 of 57 entries"; } ); oTest.fnTest( "Information with 100 records - first page", function () { $('#example_previous').click(); $("select[name=example_length]").val('100').change(); }, function () { return document.getElementById('example_info').innerHTML == "Showing 1 to 57 of 57 entries"; } ); oTest.fnTest( "Information back to 10 records", function () { $('#example_previous').click(); $("select[name=example_length]").val('10').change(); }, function () { return document.getElementById('example_info').innerHTML == "Showing 1 to 10 of 57 entries"; } ); oTest.fnTest( "Information with filter 'Win'", function () { $('#example_filter input').val("Win").keyup(); }, function () { return document.getElementById('example_info').innerHTML == "Showing 1 to 10 of 31 entries (filtered from 57 total entries)"; } ); oTest.fnTest( "Information with filter 'Win' second page", function () { $('#example_next').click(); }, function () { return document.getElementById('example_info').innerHTML == "Showing 11 to 20 of 31 entries (filtered from 57 total entries)"; } ); oTest.fnTest( "Information with filter 'Win' last page", function () { $('#example_next').click(); $('#example_next').click(); }, function () { return document.getElementById('example_info').innerHTML == "Showing 31 to 31 of 31 entries (filtered from 57 total entries)"; } ); oTest.fnTest( "Information with filter 'Win' back to first page", function () { $('#example_previous').click(); $('#example_previous').click(); $('#example_previous').click(); }, function () { return document.getElementById('example_info').innerHTML == "Showing 1 to 10 of 31 entries (filtered from 57 total entries)"; } ); oTest.fnTest( "Information with filter 'Win' second page - second time", function () { $('#example_next').click(); }, function () { return document.getElementById('example_info').innerHTML == "Showing 11 to 20 of 31 entries (filtered from 57 total entries)"; } ); oTest.fnTest( "Information with filter increased to 'Win 98'", function () { $('#example_filter input').val("Win 98").keyup(); }, function () { return document.getElementById('example_info').innerHTML == "Showing 1 to 9 of 9 entries (filtered from 57 total entries)"; } ); oTest.fnTest( "Information with filter decreased to 'Win'", function () { $('#example_filter input').val("Win").keyup(); }, function () { return document.getElementById('example_info').innerHTML == "Showing 1 to 10 of 31 entries (filtered from 57 total entries)"; } ); oTest.fnTest( "Information with filter 'Win' second page - third time", function () { $('#example_next').click(); }, function () { return document.getElementById('example_info').innerHTML == "Showing 11 to 20 of 31 entries (filtered from 57 total entries)"; } ); oTest.fnTest( "Information with filter removed", function () { $('#example_filter input').val("").keyup(); }, function () { return document.getElementById('example_info').innerHTML == "Showing 1 to 10 of 57 entries"; } ); /* * Filtering */ oTest.fnTest( "Filter 'W' - rows", function () { /* Reset the table such that the old sorting doesn't mess things up */ oSession.fnRestore(); $('#example').dataTable(); $('#example_filter input').val("W").keyup(); }, function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == "Gecko"; } ); oTest.fnTest( "Filter 'W' - info", null, function () { return document.getElementById('example_info').innerHTML == "Showing 1 to 10 of 42 entries (filtered from 57 total entries)"; } ); oTest.fnTest( "Filter 'Wi'", function () { $('#example_filter input').val("Wi").keyup(); }, function () { return document.getElementById('example_info').innerHTML == "Showing 1 to 10 of 32 entries (filtered from 57 total entries)"; } ); oTest.fnTest( "Filter 'Win'", function () { $('#example_filter input').val("Win").keyup(); }, function () { return document.getElementById('example_info').innerHTML == "Showing 1 to 10 of 31 entries (filtered from 57 total entries)"; } ); oTest.fnTest( "Filter 'Win' - sorting column 1", function () { $('#example thead th:eq(1)').click(); }, function () { return $('#example tbody tr:eq(0) td:eq(1)').html() == "AOL browser (AOL desktop)"; } ); oTest.fnTest( "Filter 'Win' - sorting column 1 info", null, function () { return document.getElementById('example_info').innerHTML == "Showing 1 to 10 of 31 entries (filtered from 57 total entries)"; } ); oTest.fnTest( "Filter 'Win' - sorting column 1 reverse", function () { $('#example thead th:eq(1)').click(); }, function () { return $('#example tbody tr:eq(0) td:eq(1)').html() == "Seamonkey 1.1"; } ); oTest.fnTest( "Filter 'Win XP' - maintaing reverse sorting col 1", function () { $('#example_filter input').val("Win XP").keyup(); }, function () { return $('#example tbody tr:eq(0) td:eq(1)').html() == "Internet Explorer 7"; } ); oTest.fnTest( "Filter 'Win XP' - sorting col 3", function () { $('#example thead th:eq(3)').click(); }, function () { return $('#example tbody tr:eq(0) td:eq(3)').html() == "4"; } ); oTest.fnTest( "Filter 'Win XP' - sorting col 3 - reversed", function () { $('#example thead th:eq(3)').click(); }, function () { return $('#example tbody tr:eq(0) td:eq(3)').html() == "7"; } ); oTest.fnTest( "Filter 'Win' - sorting col 3 - reversed info", null, function () { return document.getElementById('example_info').innerHTML == "Showing 1 to 6 of 6 entries (filtered from 57 total entries)"; } ); oTest.fnTest( "Filter 'nothinghere'", function () { $('#example_filter input').val("nothinghere").keyup(); }, function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == "No matching records found"; } ); oTest.fnTest( "Filter 'nothinghere' - info", null, function () { return document.getElementById('example_info').innerHTML == "Showing 0 to 0 of 0 entries (filtered from 57 total entries)"; } ); oTest.fnTest( "Filter back to blank and 1st column sorting", function () { $('#example_filter input').val("").keyup(); $('#example thead th:eq(0)').click(); }, function () { return document.getElementById('example_info').innerHTML == "Showing 1 to 10 of 57 entries"; } ); oTest.fnTest( "Prefixing a filter entry", function () { $('#example_filter input').val("Win").keyup(); $('#example_filter input').val("GeckoWin").keyup(); }, function () { return document.getElementById('example_info').innerHTML == "Showing 0 to 0 of 0 entries (filtered from 57 total entries)"; } ); oTest.fnTest( "Prefixing a filter entry with space", function () { $('#example_filter input').val("Gecko Win").keyup(); }, function () { return document.getElementById('example_info').innerHTML == "Showing 1 to 10 of 17 entries (filtered from 57 total entries)"; } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/1_dom/aaSorting.js000077500000000000000000000105311265711500300234650ustar00rootroot00000000000000// DATA_TEMPLATE: dom_data oTest.fnStart( "aaSorting" ); $(document).ready( function () { /* Check the default */ var oTable = $('#example').dataTable(); var oSettings = oTable.fnSettings(); oTest.fnTest( "Default sorting is single column", null, function () { return oSettings.aaSorting.length == 1 && typeof oSettings.aaSorting[0] == 'object'; } ); oTest.fnTest( "Default sorting is first column asc", null, function () { return oSettings.aaSorting[0].length == 2 && oSettings.aaSorting[0][0] == 0 && oSettings.aaSorting[0][1] == 'asc'; } ); oTest.fnTest( "Sorting is applied", null, function () { return $('#example tbody td:eq(0)').html() == "Gecko"; } ); oTest.fnTest( "Custom sorting on single string column asc", function () { oSession.fnRestore(); $('#example').dataTable( { "aaSorting": [['1','asc']] } ); }, function () { return $('#example tbody td:eq(1)').html() == "All others"; } ); oTest.fnTest( "Custom sorting on single string column desc", function () { oSession.fnRestore(); $('#example').dataTable( { "aaSorting": [['1','desc']] } ); }, function () { return $('#example tbody td:eq(1)').html() == "Seamonkey 1.1"; } ); oTest.fnTest( "Custom sorting on single int column asc", function () { oSession.fnRestore(); $('#example').dataTable( { "aaSorting": [['1','asc']] } ); }, function () { return $('#example tbody td:eq(3)').html() == "-"; } ); oTest.fnTest( "Custom sorting on single int column desc", function () { oSession.fnRestore(); $('#example').dataTable( { "aaSorting": [['1','desc']] } ); }, function () { return $('#example tbody td:eq(1)').html() == "Seamonkey 1.1"; } ); oTest.fnTest( "Multi-column sorting (2 column) - string asc / string asc", function () { oSession.fnRestore(); $('#example').dataTable( { "aaSorting": [['0','asc'], ['1','asc']] } ); }, function () { return $('#example tbody td:eq(1)').html() == "Camino 1.0"; } ); oTest.fnTest( "Multi-column sorting (2 column) - string asc / string desc", function () { oSession.fnRestore(); $('#example').dataTable( { "aaSorting": [['0','asc'], ['1','desc']] } ); }, function () { return $('#example tbody td:eq(1)').html() == "Seamonkey 1.1"; } ); oTest.fnTest( "Multi-column sorting (2 column) - string desc / string asc", function () { oSession.fnRestore(); $('#example').dataTable( { "aaSorting": [['0','desc'], ['1','asc']] } ); }, function () { return $('#example tbody td:eq(1)').html() == "iPod Touch / iPhone"; } ); oTest.fnTest( "Multi-column sorting (2 column) - string desc / string desc", function () { oSession.fnRestore(); $('#example').dataTable( { "aaSorting": [['0','desc'], ['1','desc']] } ); }, function () { return $('#example tbody td:eq(1)').html() == "Safari 3.0"; } ); oTest.fnTest( "Multi-column sorting (2 column) - string asc / int asc", function () { oSession.fnRestore(); $('#example').dataTable( { "aaSorting": [['0','asc'], ['3','asc']] } ); }, function () { return $('#example tbody td:eq(3)').html() == "1"; } ); oTest.fnTest( "Multi-column sorting (2 column) - string asc / int desc", function () { oSession.fnRestore(); $('#example').dataTable( { "aaSorting": [['0','asc'], ['3','desc']] } ); }, function () { return $('#example tbody td:eq(3)').html() == "1.9"; } ); oTest.fnTest( "Multi-column sorting (2 column) - string desc / int asc", function () { oSession.fnRestore(); $('#example').dataTable( { "aaSorting": [['0','desc'], ['3','asc']] } ); }, function () { return $('#example tbody td:eq(3)').html() == "125.5"; } ); oTest.fnTest( "Multi-column sorting (2 column) - string desc / int desc", function () { oSession.fnRestore(); $('#example').dataTable( { "aaSorting": [['0','desc'], ['3','desc']] } ); }, function () { return $('#example tbody td:eq(3)').html() == "522.1"; } ); oTest.fnTest( "Multi-column sorting (3 column) - string asc / int asc / string asc", function () { oSession.fnRestore(); $('#example').dataTable( { "aaSorting": [['0','asc'], ['3','asc'], ['1','asc']] } ); }, function () { return $('#example tbody tr:eq(7) td:eq(1)').html() == "Firefox 1.0"; } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/1_dom/aaSortingFixed.js000077500000000000000000000030731265711500300244500ustar00rootroot00000000000000// DATA_TEMPLATE: dom_data oTest.fnStart( "aaSortingFixed" ); $(document).ready( function () { /* Check the default */ var oTable = $('#example').dataTable(); var oSettings = oTable.fnSettings(); oTest.fnTest( "No fixed sorting by default", null, function () { return oSettings.aaSortingFixed.length === 0; } ); oTest.fnTest( "Fixed sorting on first column (string/asc) with user sorting on second column (string/asc)", function () { oSession.fnRestore(); $('#example').dataTable( { "aaSortingFixed": [['0','asc']] } ); $('#example thead th:eq(1)').click(); }, function () { return $('#example tbody td:eq(1)').html() == "Camino 1.0"; } ); oTest.fnTest( "Fixed sorting on first column (string/asc) with user sorting on second column (string/desc)", function () { $('#example thead th:eq(1)').click(); }, function () { return $('#example tbody td:eq(1)').html() == "Seamonkey 1.1"; } ); oTest.fnTest( "Fixed sorting on fourth column (int/asc) with user sorting on second column (string/asc)", function () { oSession.fnRestore(); $('#example').dataTable( { "aaSortingFixed": [['3','asc']] } ); $('#example thead th:eq(1)').click(); }, function () { return $('#example tbody td:eq(1)').html() == "All others"; } ); oTest.fnTest( "Fixed sorting on fourth column (int/asc) with user sorting on second column (string/desc)", function () { $('#example thead th:eq(1)').click(); }, function () { return $('#example tbody td:eq(1)').html() == "PSP browser"; } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/1_dom/aoColumns.bSearchable.js000077500000000000000000000033171265711500300256740ustar00rootroot00000000000000// DATA_TEMPLATE: dom_data oTest.fnStart( "aoColumns.bSeachable" ); $(document).ready( function () { /* Check the default */ var oTable = $('#example').dataTable(); var oSettings = oTable.fnSettings(); oTest.fnTest( "Columns are searchable by default", function () { oTable.fnFilter("Camino"); }, function () { return $('#example tbody tr:eq(0) td:eq(1)').html().match(/Camino/); } ); oTest.fnTest( "Disabling sorting on a column removes it from the global filter", function () { oSession.fnRestore(); oTable = $('#example').dataTable( { "aoColumns": [ null, { "bSearchable": false }, null, null, null ] } ); oSettings = oTable.fnSettings(); oTable.fnFilter("Camino"); }, function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == "No matching records found"; } ); oTest.fnTest( "Disabled on one column has no effect on other columns", function () { oTable.fnFilter("Webkit"); }, function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == "Webkit"; } ); oTest.fnTest( "Disable filtering on multiple columns", function () { oSession.fnRestore(); oTable = $('#example').dataTable( { "aoColumns": [ { "bSearchable": false }, { "bSearchable": false }, null, null, null ] } ); oSettings = oTable.fnSettings(); oTable.fnFilter("Webkit"); }, function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == "No matching records found"; } ); oTest.fnTest( "Filter on second disabled column", function () { oTable.fnFilter("Camino"); }, function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == "No matching records found"; } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/1_dom/aoColumns.bSortable.js000077500000000000000000000050401265711500300254110ustar00rootroot00000000000000// DATA_TEMPLATE: dom_data oTest.fnStart( "aoColumns.bSortable" ); $(document).ready( function () { /* Check the default */ var oTable = $('#example').dataTable(); var oSettings = oTable.fnSettings(); oTest.fnTest( "All columns are sortable by default", function () { $('#example thead th:eq(1)').click(); }, function () { return $('#example tbody tr:eq(0) td:eq(1)').html() == "All others"; } ); oTest.fnTest( "Can disable sorting from one column", function () { oSession.fnRestore(); $('#example').dataTable( { "aoColumns": [ null, { "bSortable": false }, null, null, null ] } ); $('#example thead th:eq(1)').click(); }, function () { return $('#example tbody tr:eq(0) td:eq(1)').html() != "All others"; } ); oTest.fnTest( "Disabled column has no sorting class", null, function () { return $('#example thead th:eq(1)').hasClass("sorting_asc") == false; } ); oTest.fnTest( "Other columns can still sort", function () { $('#example thead th:eq(4)').click(); $('#example thead th:eq(4)').click(); }, function () { return $('#example tbody tr:eq(0) td:eq(4)').html() == "X"; } ); oTest.fnTest( "Disable sorting on multiple columns - no sorting classes", function () { oSession.fnRestore(); $('#example').dataTable( { "aoColumns": [ null, { "bSortable": false }, null, { "bSortable": false }, null ] } ); }, function () { var bReturn = $('#example thead th:eq(1)').hasClass("sorting") || $('#example thead th:eq(3)').hasClass("sorting") return bReturn == false; } ); oTest.fnTest( "Sorting on disabled column 1 has no effect", function () { $('#example thead th:eq(1)').click(); }, function () { return $('#example tbody tr:eq(0) td:eq(1)').html() != "All others"; } ); oTest.fnTest( "Sorting on disabled column 2 has no effect", function () { $('#example thead th:eq(3)').click(); }, function () { return $('#example tbody tr:eq(0) td:eq(3)').html() != "-"; } ); oTest.fnTest( "Second sort on disabled column 2 has no effect", function () { $('#example thead th:eq(3)').click(); }, function () { return $('#example tbody tr:eq(0) td:eq(3)').html() != "-"; } ); oTest.fnTest( "Even with multiple disabled sorting columns other columns can still sort", function () { $('#example thead th:eq(4)').click(); $('#example thead th:eq(4)').click(); }, function () { return $('#example tbody tr:eq(0) td:eq(4)').html() == "X"; } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/1_dom/aoColumns.bVisible.js000077500000000000000000000061251265711500300252400ustar00rootroot00000000000000// DATA_TEMPLATE: dom_data oTest.fnStart( "aoColumns.bVisible" ); $(document).ready( function () { /* Check the default */ var oTable = $('#example').dataTable(); var oSettings = oTable.fnSettings(); oTest.fnTest( "All columns are visible by default", null, function () { return $('#example tbody tr:eq(0) td').length == 5; } ); oTest.fnTest( "Can hide one column and it removes td column from DOM", function () { oSession.fnRestore(); $('#example').dataTable( { "aoColumns": [ null, { "bVisible": false }, null, null, null ] } ); }, function () { return $('#example tbody tr:eq(0) td').length == 4; } ); oTest.fnTest( "Can hide one column and it removes thead th column from DOM", null, function () { return $('#example thead tr:eq(0) th').length == 4; } ); oTest.fnTest( "Can hide one column and it removes tfoot th column from DOM", null, function () { return $('#example tfoot tr:eq(0) th').length == 4; } ); oTest.fnTest( "The correct thead column has been hidden", null, function () { var jqNodes = $('#example thead tr:eq(0) th'); var bReturn = jqNodes[0].innerHTML == "Rendering engine" && jqNodes[1].innerHTML == "Platform(s)" && jqNodes[2].innerHTML == "Engine version" && jqNodes[3].innerHTML == "CSS grade"; return bReturn; } ); oTest.fnTest( "The correct tbody column has been hidden", function () { oDispacher.click( $('#example thead th:eq(1)')[0], { 'shift': true } ); }, function () { var jqNodes = $('#example tbody tr:eq(0) td'); var bReturn = jqNodes[0].innerHTML == "Gecko" && jqNodes[1].innerHTML == "Gnome" && jqNodes[2].innerHTML == "1.8" && jqNodes[3].innerHTML == "A"; return bReturn; } ); oTest.fnTest( "Can hide multiple columns and it removes td column from DOM", function () { oSession.fnRestore(); $('#example').dataTable( { "aoColumns": [ null, { "bVisible": false }, { "bVisible": false }, null, { "bVisible": false } ] } ); }, function () { return $('#example tbody tr:eq(0) td').length == 2; } ); oTest.fnTest( "Multiple hide - removes thead th column from DOM", null, function () { return $('#example thead tr:eq(0) th').length == 2; } ); oTest.fnTest( "Multiple hide - removes tfoot th column from DOM", null, function () { return $('#example tfoot tr:eq(0) th').length == 2; } ); oTest.fnTest( "Multiple hide - the correct thead columns have been hidden", null, function () { var jqNodes = $('#example thead tr:eq(0) th'); var bReturn = jqNodes[0].innerHTML == "Rendering engine" && jqNodes[1].innerHTML == "Engine version" return bReturn; } ); oTest.fnTest( "Multiple hide - the correct tbody columns have been hidden", function () { oDispacher.click( $('#example thead th:eq(1)')[0], { 'shift': true } ); }, function () { var jqNodes = $('#example tbody tr:eq(0) td'); var bReturn = jqNodes[0].innerHTML == "Gecko" && jqNodes[1].innerHTML == "1" return bReturn; } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/1_dom/aoColumns.bVisible2.js000077500000000000000000000145531265711500300253260ustar00rootroot00000000000000// DATA_TEMPLATE: complex_header_2 oTest.fnStart( "aoColumns.bVisible with complex headers" ); $(document).ready( function () { /* Check the default */ var oTable = $('#example').dataTable(); var oSettings = oTable.fnSettings(); oTest.fnTest( "All columns are visible by default", null, function () { return $('#example tbody tr:eq(0) td').length == 5; } ); oTest.fnTest( "Hide the first column", function () { oSession.fnRestore(); $('#example').dataTable( { "aoColumns": [ { "bVisible": false }, null, null, null, null ] } ); }, function () { return $('#example tbody tr:eq(0) td').length == 4; } ); oTest.fnTest( "First cell is '2' - first column hidden", null, function () { return $('#example thead tr:eq(0) th:eq(0)').html() == "2"; } ); oTest.fnTest( "First cell has colspan of 3", null, function () { return $('#example thead tr:eq(0) th:eq(0)')[0].getAttribute('colspan') == 3; } ); oTest.fnTest( "First cell has rowspan of 2", null, function () { return $('#example thead tr:eq(0) th:eq(0)')[0].getAttribute('rowspan') == 2; } ); oTest.fnTest( "First cell in last column is '11'", null, function () { return $('#example thead tr:eq(4) th:eq(0)').html() == 11; } ); oTest.fnTest( "First cell in last column has been truncated to one column", null, function () { return $('#example thead tr:eq(4) th:eq(0)')[0].getAttribute('colspan') == 1; } ); oTest.fnTest( "Hide the second column", function () { oSession.fnRestore(); $('#example').dataTable( { "aoColumns": [ null, { "bVisible": false }, null, null, null ] } ); }, function () { return $('#example tbody tr:eq(0) td').length == 4; } ); oTest.fnTest( "First cell is '1' - second column hidden", null, function () { return $('#example thead tr:eq(0) th:eq(0)').html() == "1"; } ); oTest.fnTest( "Second cell is '2' - second column hidden", null, function () { return $('#example thead tr:eq(0) th:eq(1)').html() == "2"; } ); oTest.fnTest( "First cell in fourth row is '10' (visibly the first) - second column hidden", null, function () { return $('#example thead tr:eq(3) th:eq(0)').html() == "10"; } ); oTest.fnTest( "First cell has colspan of 1", null, function () { return $('#example thead tr:eq(0) th:eq(0)')[0].getAttribute('colspan') == 1; } ); oTest.fnTest( "Second cell has colspan of 2", null, function () { return $('#example thead tr:eq(0) th:eq(1)')[0].getAttribute('colspan') == 2; } ); oTest.fnTest( "First cell has rowspan of 1", null, function () { return $('#example thead tr:eq(0) th:eq(0)')[0].getAttribute('rowspan') == 1; } ); oTest.fnTest( "Second cell has rowspan of 2", null, function () { return $('#example thead tr:eq(0) th:eq(1)')[0].getAttribute('rowspan') == 2; } ); oTest.fnTest( "First cell in last column is '11'", null, function () { return $('#example thead tr:eq(4) th:eq(0)').html() == 11; } ); oTest.fnTest( "First cell in last column has been truncated to one column", null, function () { return $('#example thead tr:eq(4) th:eq(0)')[0].getAttribute('colspan') == 1; } ); oTest.fnTest( "Hide the first two columns", function () { oSession.fnRestore(); $('#example').dataTable( { "aoColumns": [ { "bVisible": false }, { "bVisible": false }, null, null, null ] } ); }, function () { return $('#example tbody tr:eq(0) td').length == 3; } ); oTest.fnTest( "First cell is '2' - first two columns hidden", null, function () { return $('#example thead tr:eq(0) th:eq(0)').html() == "2"; } ); oTest.fnTest( "Second cell is '3' - first two columns hidden", null, function () { return $('#example thead tr:eq(0) th:eq(1)').html() == "3"; } ); oTest.fnTest( "First cell in third row is '6' - first two columns hidden", null, function () { return $('#example thead tr:eq(2) th:eq(0)').html() == "6"; } ); oTest.fnTest( "First cell has colspan of 2", null, function () { return $('#example thead tr:eq(0) th:eq(0)')[0].getAttribute('colspan') == 2; } ); oTest.fnTest( "First cell has rowspan of 2", null, function () { return $('#example thead tr:eq(0) th:eq(0)')[0].getAttribute('rowspan') == 2; } ); oTest.fnTest( "Second cell has rowspan of 1", null, function () { return $('#example thead tr:eq(0) th:eq(1)')[0].getAttribute('rowspan') == 1; } ); oTest.fnTest( "First cell in last column is '12'", null, function () { return $('#example thead tr:eq(4) th:eq(0)').html() == 12; } ); oTest.fnTest( "Hide the third column", function () { oSession.fnRestore(); $('#example').dataTable( { "aoColumns": [ null, null, { "bVisible": false }, null, null ] } ); }, function () { return $('#example tbody tr:eq(0) td').length == 4; } ); oTest.fnTest( "First cell is '1' - third column hidden", null, function () { return $('#example thead tr:eq(0) th:eq(0)').html() == "1"; } ); oTest.fnTest( "Second cell is '2' - third column hidden", null, function () { return $('#example thead tr:eq(0) th:eq(1)').html() == "2"; } ); oTest.fnTest( "First cell (visible second) in third row is '6' - third column hidden", null, function () { return $('#example thead tr:eq(2) th:eq(0)').html() == "6"; } ); oTest.fnTest( "Second cell has colspan of 2", null, function () { return $('#example thead tr:eq(0) th:eq(1)')[0].getAttribute('colspan') == 2; } ); oTest.fnTest( "Second cell has rowspan of 2", null, function () { return $('#example thead tr:eq(0) th:eq(1)')[0].getAttribute('rowspan') == 2; } ); oTest.fnTest( "Third row first cell (second visible) colspan is 1", null, function () { return $('#example thead tr:eq(2) th:eq(0)')[0].getAttribute('colspan') == 1; } ); oTest.fnTest( "Third row second cell (third visible) value is 7", null, function () { return $('#example thead tr:eq(2) th:eq(1)').html() == "7"; } ); oTest.fnTest( "Third row second cell (third visible) colspan is 1", null, function () { return $('#example thead tr:eq(2) th:eq(1)')[0].getAttribute('colspan') == 1; } ); oTest.fnTest( "Third row second cell (third visible) rowspan is 3", null, function () { return $('#example thead tr:eq(2) th:eq(1)')[0].getAttribute('rowspan') == 3; } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/1_dom/aoColumns.iDataSort.js000077500000000000000000000045601265711500300253740ustar00rootroot00000000000000// DATA_TEMPLATE: dom_data oTest.fnStart( "aoColumns.iDataSort" ); $(document).ready( function () { /* Should know that sorting already works by default from other tests, so we can jump * right in here */ var oTable = $('#example').dataTable( { "aoColumns": [ null, { "iDataSort": 4 }, null, null, null ] } ); var oSettings = oTable.fnSettings(); oTest.fnTest( "Sorting on first column is uneffected", null, function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == 'Gecko'; } ); oTest.fnTest( "Sorting on second column is the order of the fifth", function () { $('#example thead th:eq(1)').click(); }, function () { return $('#example tbody tr:eq(0) td:eq(4)').html() == 'A'; } ); oTest.fnTest( "Reserve sorting on second column uses fifth column as well", function () { $('#example thead th:eq(1)').click(); }, function () { return $('#example tbody tr:eq(0) td:eq(4)').html() == 'X'; } ); oTest.fnTest( "Sorting on 5th column retains it's own sorting", function () { $('#example thead th:eq(4)').click(); }, function () { return $('#example tbody tr:eq(0) td:eq(4)').html() == 'A'; } ); oTest.fnTest( "Use 2nd col for sorting 5th col and via-versa - no effect on first col sorting", function () { mTmp = 0; oSession.fnRestore(); oTable = $('#example').dataTable( { "aoColumns": [ null, { "iDataSort": 4 }, null, null, { "iDataSort": 1 } ] } ); }, function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == 'Gecko'; } ); oTest.fnTest( "2nd col sorting uses fifth col", function () { $('#example thead th:eq(1)').click(); }, function () { return $('#example tbody tr:eq(0) td:eq(4)').html() == 'A'; } ); oTest.fnTest( "2nd col sorting uses fifth col - reversed", function () { $('#example thead th:eq(1)').click(); }, function () { return $('#example tbody tr:eq(0) td:eq(4)').html() == 'X'; } ); oTest.fnTest( "5th col sorting uses 2nd col", function () { $('#example thead th:eq(4)').click(); }, function () { return $('#example tbody tr:eq(0) td:eq(1)').html() == 'All others'; } ); oTest.fnTest( "5th col sorting uses 2nd col - reversed", function () { $('#example thead th:eq(4)').click(); }, function () { return $('#example tbody tr:eq(0) td:eq(1)').html() == 'Seamonkey 1.1'; } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/1_dom/aoColumns.sClass.js000077500000000000000000000056371265711500300247400ustar00rootroot00000000000000// DATA_TEMPLATE: dom_data oTest.fnStart( "aoColumns.sClass" ); $(document).ready( function () { /* Check the default */ var oTable = $('#example').dataTable(); var oSettings = oTable.fnSettings(); oTest.fnTest( "By default the test class hasn't been applied to the column (sanity!)", null, function () { return $('#example tbody tr:eq(0) td:eq(2)').hasClass('unittest') == false; } ); oTest.fnTest( "Add a class to a single column - first row", function () { oSession.fnRestore(); $('#example').dataTable( { "aoColumns": [ null, null, { "sClass": 'unittest' }, null, null ] } ); }, function () { return $('#example tbody tr:eq(1) td:eq(2)').hasClass('unittest'); } ); oTest.fnTest( "Add a class to a single column - third row", null, function () { return $('#example tbody tr:eq(3) td:eq(2)').hasClass('unittest'); } ); oTest.fnTest( "Add a class to a single column - last row", null, function () { return $('#example tbody tr:eq(9) td:eq(2)').hasClass('unittest'); } ); oTest.fnTest( "Add a class to a single column - has not applied to other columns - 1st", null, function () { return $('#example tbody tr:eq(3) td:eq(0)').hasClass('unittest') == false; } ); oTest.fnTest( "Add a class to a single column - has not applied to other columns - 5th", null, function () { return $('#example tbody tr:eq(3) td:eq(4)').hasClass('unittest') == false; } ); oTest.fnTest( "Add a class to a single column - seventh row - second page", function () { $('#example_next').click(); }, function () { return $('#example tbody tr:eq(6) td:eq(2)').hasClass('unittest'); } ); oTest.fnTest( "Add a class to a single column - has not applied to header", null, function () { return $('#example thead tr:eq(3) th:eq(4)').hasClass('unittest') == false; } ); oTest.fnTest( "Add a class to a single column - has not applied to footer", null, function () { return $('#example thead tr:eq(3) th:eq(4)').hasClass('unittest') == false; } ); oTest.fnTest( "Class defined for multiple columns - first row", function () { oSession.fnRestore(); $('#example').dataTable( { "aoColumns": [ { "sClass": 'unittest2' }, null, null, { "sClass": 'unittest1' }, null ] } ); }, function () { var bReturn = $('#example tbody tr:eq(3) td:eq(0)').hasClass('unittest2') && $('#example tbody tr:eq(8) td:eq(3)').hasClass('unittest1'); return bReturn; } ); oTest.fnTest( "Class defined for multiple columns - has not applied to other columns - 5th 1", null, function () { return $('#example tbody tr:eq(0) td:eq(4)').hasClass('unittest1') == false; } ); oTest.fnTest( "Class defined for multiple columns - has not applied to other columns - 5th 2", null, function () { return $('#example tbody tr:eq(6) td:eq(4)').hasClass('unittest2') == false; } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/1_dom/aoColumns.sName.js000077500000000000000000000010601265711500300245350ustar00rootroot00000000000000// DATA_TEMPLATE: dom_data oTest.fnStart( "aoColumns.sName" ); /* This has no effect at all in DOM methods - so we just check that it has applied the name */ $(document).ready( function () { /* Check the default */ var oTable = $('#example').dataTable( { "aoColumns": [ null, null, null, { "sName": 'unit test' }, null ] } ); var oSettings = oTable.fnSettings(); oTest.fnTest( "Names are stored in the columns object", null, function () { return oSettings.aoColumns[3].sName =="unit test"; } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/1_dom/aoColumns.sTitle.js000077500000000000000000000034771265711500300247540ustar00rootroot00000000000000// DATA_TEMPLATE: dom_data oTest.fnStart( "aoColumns.sTitle" ); $(document).ready( function () { /* Check the default */ var oTable = $('#example').dataTable(); var oSettings = oTable.fnSettings(); oTest.fnTest( "Column names are read from the DOM by default", null, function () { var jqNodes = $('#example thead tr:eq(0) th'); var bReturn = jqNodes[0].innerHTML == "Rendering engine" && jqNodes[1].innerHTML == "Browser" && jqNodes[2].innerHTML == "Platform(s)" && jqNodes[3].innerHTML == "Engine version" && jqNodes[4].innerHTML == "CSS grade"; return bReturn; } ); oTest.fnTest( "Can set a single column title - and others are read from DOM", function () { oSession.fnRestore(); $('#example').dataTable( { "aoColumns": [ null, { "sTitle": 'unit test' }, null, null, null ] } ); }, function () { var jqNodes = $('#example thead tr:eq(0) th'); var bReturn = jqNodes[0].innerHTML == "Rendering engine" && jqNodes[1].innerHTML == "unit test" && jqNodes[2].innerHTML == "Platform(s)" && jqNodes[3].innerHTML == "Engine version" && jqNodes[4].innerHTML == "CSS grade"; return bReturn; } ); oTest.fnTest( "Can set multiple column titles", function () { oSession.fnRestore(); $('#example').dataTable( { "aoColumns": [ null, { "sTitle": 'unit test 1' }, null, null, { "sTitle": 'unit test 2' } ] } ); }, function () { var jqNodes = $('#example thead tr:eq(0) th'); var bReturn = jqNodes[0].innerHTML == "Rendering engine" && jqNodes[1].innerHTML == "unit test 1" && jqNodes[2].innerHTML == "Platform(s)" && jqNodes[3].innerHTML == "Engine version" && jqNodes[4].innerHTML == "unit test 2"; return bReturn; } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/1_dom/aoColumns.sWidth.js000077500000000000000000000035561265711500300247500ustar00rootroot00000000000000// DATA_TEMPLATE: dom_data oTest.fnStart( "aoColumns.sWidth" ); /* NOTE - we need to disable the auto width for the majority of these test in order to preform * these tests as the auto width will convert the width to a px value. We can do 'non-exact' tests * with auto width enabled however to ensure it scales columns as required */ $(document).ready( function () { /* Check the default */ var oTable = $('#example').dataTable( { "bAutoWidth": false, "aoColumns": [ null, { "sWidth": '40%' }, null, null, null ] } ); var oSettings = oTable.fnSettings(); oTest.fnTest( "With auto width disabled the width for one column is appled", null, function () { return $('#example thead th:eq(1)')[0].style.width == "40%"; } ); oTest.fnTest( "With auto width disabled the width for one column is appled", function () { oSession.fnRestore(); oTable = $('#example').dataTable( { "bAutoWidth": false, "aoColumns": [ null, null, { "sWidth": '20%' }, { "sWidth": '30%' }, null ] } ); }, function () { var bReturn = $('#example thead th:eq(2)')[0].style.width == "20%" && $('#example thead th:eq(3)')[0].style.width == "30%"; return bReturn; } ); oTest.fnTest( "With auto width, it will make the smallest column the largest with percentage width given", function () { oSession.fnRestore(); oTable = $('#example').dataTable( { "aoColumns": [ null, null, null, { "sWidth": '40%' }, null ] } ); }, function () { var anThs = $('#example thead th'); var a0 = anThs[0].offsetWidth; var a1 = anThs[1].offsetWidth; var a2 = anThs[2].offsetWidth; var a3 = anThs[3].offsetWidth; var a4 = anThs[4].offsetWidth; if ( a3>a0 && a3>a1 && a3>a2 && a3>a4 ) return true; else return false; } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/1_dom/aoSearchCols.js000077500000000000000000000056601265711500300241130ustar00rootroot00000000000000// DATA_TEMPLATE: dom_data oTest.fnStart( "aoSearchCols" ); /* We could be here forever testing this one, so we test a limited subset on a couple of colums */ $(document).ready( function () { /* Check the default */ var oTable = $('#example').dataTable(); var oSettings = oTable.fnSettings(); oTest.fnTest( "Default should be to have a empty colums array", null, function () { var bReturn = oSettings.aoPreSearchCols[0].sSearch == 0 && !oSettings.aoPreSearchCols[0].bRegex && oSettings.aoPreSearchCols[1].sSearch == 0 && !oSettings.aoPreSearchCols[1].bRegex && oSettings.aoPreSearchCols[2].sSearch == 0 && !oSettings.aoPreSearchCols[2].bRegex && oSettings.aoPreSearchCols[3].sSearch == 0 && !oSettings.aoPreSearchCols[3].bRegex && oSettings.aoPreSearchCols[4].sSearch == 0 && !oSettings.aoPreSearchCols[4].bRegex; return bReturn; } ); oTest.fnTest( "Search on a single column - no regex statement given", function () { oSession.fnRestore(); oTable = $('#example').dataTable( { "aoSearchCols": [ null, { "sSearch": "Mozilla" }, null, { "sSearch": "1" }, null ] } ); }, function () { return $('#example_info').html() == "Showing 1 to 9 of 9 entries (filtered from 57 total entries)"; } ); oTest.fnTest( "Search on two columns - no regex statement given", function () { oSession.fnRestore(); oTable = $('#example').dataTable( { "aoSearchCols": [ null, { "sSearch": "Mozilla" }, null, { "sSearch": "1.5" }, null ] } ); }, function () { return $('#example tbody tr:eq(0) td:eq(3)').html() == "1.5"; } ); oTest.fnTest( "Search on single column - escape regex false", function () { oSession.fnRestore(); oTable = $('#example').dataTable( { "aoSearchCols": [ { "sSearch": ".*ML", "bEscapeRegex": false }, null, null, null, null ] } ); }, function () { return $('#example_info').html() == "Showing 1 to 3 of 3 entries (filtered from 57 total entries)"; } ); oTest.fnTest( "Search on two columns - escape regex false on first, true on second", function () { oSession.fnRestore(); oTable = $('#example').dataTable( { "aoSearchCols": [ { "sSearch": ".*ML", "bEscapeRegex": false }, { "sSearch": "3.3", "bEscapeRegex": true }, null, null, null ] } ); }, function () { return $('#example tbody tr:eq(0) td:eq(1)').html() == "Konqureror 3.3"; } ); oTest.fnTest( "Search on two columns (no records) - escape regex false on first, true on second", function () { oSession.fnRestore(); oTable = $('#example').dataTable( { "aoSearchCols": [ { "sSearch": ".*ML", "bEscapeRegex": false }, { "sSearch": "Allan", "bEscapeRegex": true }, null, null, null ] } ); }, function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == "No matching records found"; } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/1_dom/asStripClasses.js000077500000000000000000000056371265711500300245140ustar00rootroot00000000000000// DATA_TEMPLATE: dom_data oTest.fnStart( "asStripeClasses" ); $(document).ready( function () { /* Check the default */ $('#example').dataTable(); oTest.fnTest( "Default row striping is applied", null, function () { return $('#example tbody tr:eq(0)').hasClass('odd') && $('#example tbody tr:eq(1)').hasClass('even') && $('#example tbody tr:eq(2)').hasClass('odd') && $('#example tbody tr:eq(3)').hasClass('even'); } ); oTest.fnTest( "Row striping does not effect current classes", null, function () { return $('#example tbody tr:eq(0)').hasClass('gradeA') && $('#example tbody tr:eq(1)').hasClass('gradeA') && $('#example tbody tr:eq(2)').hasClass('gradeA') && $('#example tbody tr:eq(3)').hasClass('gradeA'); } ); oTest.fnTest( "Row striping on the second page", function () { $('#example_next').click(); }, function () { return $('#example tbody tr:eq(0)').hasClass('odd') && $('#example tbody tr:eq(1)').hasClass('even') && $('#example tbody tr:eq(2)').hasClass('odd') && $('#example tbody tr:eq(3)').hasClass('even'); } ); /* No striping */ oTest.fnTest( "No row striping", function () { oSession.fnRestore(); $('#example').dataTable( { "asStripeClasses": [] } ); }, function () { return $('#example tbody tr:eq(0)')[0].className == "gradeA" && $('#example tbody tr:eq(1)')[0].className == "gradeA" && $('#example tbody tr:eq(2)')[0].className == "gradeA" && $('#example tbody tr:eq(3)')[0].className == "gradeA"; } ); /* Custom striping */ oTest.fnTest( "Custom striping [2]", function () { oSession.fnRestore(); $('#example').dataTable( { "asStripeClasses": [ 'test1', 'test2' ] } ); }, function () { return $('#example tbody tr:eq(0)').hasClass('test1') && $('#example tbody tr:eq(1)').hasClass('test2') && $('#example tbody tr:eq(2)').hasClass('test1') && $('#example tbody tr:eq(3)').hasClass('test2'); } ); /* long array of striping */ oTest.fnTest( "Custom striping [4]", function () { oSession.fnRestore(); $('#example').dataTable( { "asStripeClasses": [ 'test1', 'test2', 'test3', 'test4' ] } ); }, function () { return $('#example tbody tr:eq(0)').hasClass('test1') && $('#example tbody tr:eq(1)').hasClass('test2') && $('#example tbody tr:eq(2)').hasClass('test3') && $('#example tbody tr:eq(3)').hasClass('test4'); } ); oTest.fnTest( "Custom striping is restarted on second page [2]", function () { $('#example_next').click(); }, function () { return $('#example tbody tr:eq(0)').hasClass('test1') && $('#example tbody tr:eq(1)').hasClass('test2') && $('#example tbody tr:eq(2)').hasClass('test3') && $('#example tbody tr:eq(3)').hasClass('test4'); } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/1_dom/bAutoWidth.js000077500000000000000000000071301265711500300236110ustar00rootroot00000000000000// DATA_TEMPLATE: dom_data oTest.fnStart( "bAutoWidth" ); /* It's actually a little tricky to test this. We can't test absolute numbers because * different browsers and different platforms will render the width of the columns slightly * differently. However, we certainly can test the principle of what should happen (column * width doesn't change over pages) */ $(document).ready( function () { /* Check the default */ var oTable = $('#example').dataTable(); var oSettings = oTable.fnSettings(); oTest.fnTest( "Auto width is enabled by default", null, function () { return oSettings.oFeatures.bAutoWidth; } ); oTest.fnTest( "First column has a width assigned to it", null, function () { return $('#example thead th:eq(0)').attr('style').match(/width/i); } ); /* This would seem like a better test - but there appear to be difficulties with tables which are bigger (calculated) than there is actually room for. I suspect this is actually a bug in datatables oTest.fnTest( "Check column widths on first page match second page", null, function () { var anThs = $('#example thead th'); var a0 = anThs[0].offsetWidth; var a1 = anThs[1].offsetWidth; var a2 = anThs[2].offsetWidth; var a3 = anThs[3].offsetWidth; var a4 = anThs[4].offsetWidth; $('#example_next').click(); var b0 = anThs[0].offsetWidth; var b1 = anThs[1].offsetWidth; var b2 = anThs[2].offsetWidth; var b3 = anThs[3].offsetWidth; var b4 = anThs[4].offsetWidth; console.log( a0, b0, a1, b1, a2, b2, a3, b3 ); if ( a0==b0 && a1==b1 && a2==b2 && a3==b3 ) return true; else return false; } ); oTest.fnTest( "Check column widths on second page match thid page", null, function () { var anThs = $('#example thead th'); var a0 = anThs[0].offsetWidth; var a1 = anThs[1].offsetWidth; var a2 = anThs[2].offsetWidth; var a3 = anThs[3].offsetWidth; var a4 = anThs[4].offsetWidth; $('#example_next').click(); var b0 = anThs[0].offsetWidth; var b1 = anThs[1].offsetWidth; var b2 = anThs[2].offsetWidth; var b3 = anThs[3].offsetWidth; var b4 = anThs[4].offsetWidth; if ( a0==b0 && a1==b1 && a2==b2 && a3==b3 ) return true; else return false; } ); */ /* Check can disable */ oTest.fnTest( "Auto width can be disabled", function () { oSession.fnRestore(); oTable = $('#example').dataTable( { "bAutoWidth": false } ); oSettings = oTable.fnSettings(); }, function () { return oSettings.oFeatures.bAutoWidth == false; } ); oTest.fnTest( "First column does not have a width assigned to it", null, function () { return $('#example thead th:eq(0)').attr('style') == null; } ); /* oTest.fnTest( "Check column widths on first page do not match second page", null, function () { var anThs = $('#example thead th'); var a0 = anThs[0].offsetWidth; var a1 = anThs[1].offsetWidth; var a2 = anThs[2].offsetWidth; var a3 = anThs[3].offsetWidth; var a4 = anThs[4].offsetWidth; $('#example_next').click(); var b0 = anThs[0].offsetWidth; var b1 = anThs[1].offsetWidth; var b2 = anThs[2].offsetWidth; var b3 = anThs[3].offsetWidth; var b4 = anThs[4].offsetWidth; if ( a0==b0 && a1==b1 && a2==b2 && a3==b3 ) return false; else return true; } ); */ /* Enable makes no difference */ oTest.fnTest( "Auto width enabled override", function () { oSession.fnRestore(); oTable = $('#example').dataTable( { "bAutoWidth": true } ); oSettings = oTable.fnSettings(); }, function () { return oSettings.oFeatures.bAutoWidth; } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/1_dom/bFilter.js000077500000000000000000000015101265711500300231220ustar00rootroot00000000000000// DATA_TEMPLATE: dom_data oTest.fnStart( "bFilter" ); $(document).ready( function () { /* Check the default */ $('#example').dataTable(); oTest.fnTest( "Filtering div exists by default", null, function () { return document.getElementById('example_filter') != null; } ); /* Check can disable */ oTest.fnTest( "Fltering can be disabled", function () { oSession.fnRestore(); $('#example').dataTable( { "bFilter": false } ); }, function () { return document.getElementById('example_filter') == null; } ); /* Enable makes no difference */ oTest.fnTest( "Filtering enabled override", function () { oSession.fnRestore(); $('#example').dataTable( { "bFilter": true } ); }, function () { return document.getElementById('example_filter') != null; } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/1_dom/bInfo.js000077500000000000000000000014561265711500300226010ustar00rootroot00000000000000// DATA_TEMPLATE: dom_data oTest.fnStart( "bInfo" ); $(document).ready( function () { /* Check the default */ $('#example').dataTable(); oTest.fnTest( "Info div exists by default", null, function () { return document.getElementById('example_info') != null; } ); /* Check can disable */ oTest.fnTest( "Info can be disabled", function () { oSession.fnRestore(); $('#example').dataTable( { "bInfo": false } ); }, function () { return document.getElementById('example_info') == null; } ); /* Enable makes no difference */ oTest.fnTest( "Info enabled override", function () { oSession.fnRestore(); $('#example').dataTable( { "bInfo": true } ); }, function () { return document.getElementById('example_info') != null; } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/1_dom/bJQueryUI.js000077500000000000000000000013211265711500300233520ustar00rootroot00000000000000// DATA_TEMPLATE: dom_data oTest.fnStart( "bJQueryUI" ); $(document).ready( function () { $('#example').dataTable( { "bJQueryUI": true } ); oTest.fnTest( "Header elements are fully wrapped by DIVs", null, function () { var test = true; $('#example thead th').each( function () { if ( this.childNodes > 1 ) { test = false; } } ); return test; } ); oTest.fnTest( "One div for each header element", null, function () { return $('#example thead th div').length == 5; } ); oTest.fnTest( "One span for each header element, nested as child of div", null, function () { return $('#example thead th div>span').length == 5; } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/1_dom/bLengthChange.js000077500000000000000000000032071265711500300242310ustar00rootroot00000000000000// DATA_TEMPLATE: dom_data oTest.fnStart( "bLengthChange" ); $(document).ready( function () { /* Check the default */ $('#example').dataTable(); oTest.fnTest( "Length div exists by default", null, function () { return document.getElementById('example_length') != null; } ); oTest.fnTest( "Four default options", null, function () { return $("select[name=example_length] option").length == 4; } ); oTest.fnTest( "Default options", null, function () { var opts = $("select[name='example_length'] option"); return opts[0].getAttribute('value') == 10 && opts[1].getAttribute('value') == 25 && opts[2].getAttribute('value') == 50 && opts[3].getAttribute('value') == 100; } ); oTest.fnTest( "Info takes length into account", null, function () { return document.getElementById('example_info').innerHTML == "Showing 1 to 10 of 57 entries"; } ); /* Check can disable */ oTest.fnTest( "Change length can be disabled", function () { oSession.fnRestore(); $('#example').dataTable( { "bLengthChange": false } ); }, function () { return document.getElementById('example_length') == null; } ); oTest.fnTest( "Information takes length disabled into account", null, function () { return document.getElementById('example_info').innerHTML == "Showing 1 to 10 of 57 entries"; } ); /* Enable makes no difference */ oTest.fnTest( "Length change enabled override", function () { oSession.fnRestore(); $('#example').dataTable( { "bLengthChange": true } ); }, function () { return document.getElementById('example_length') != null; } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/1_dom/bPaginate.js000077500000000000000000000023411265711500300234300ustar00rootroot00000000000000// DATA_TEMPLATE: dom_data oTest.fnStart( "bPaginate" ); $(document).ready( function () { /* Check the default */ $('#example').dataTable(); oTest.fnTest( "Pagiantion div exists by default", null, function () { return document.getElementById('example_paginate') != null; } ); oTest.fnTest( "Information div takes paging into account", null, function () { return document.getElementById('example_info').innerHTML == "Showing 1 to 10 of 57 entries"; } ); /* Check can disable */ oTest.fnTest( "Pagiantion can be disabled", function () { oSession.fnRestore(); $('#example').dataTable( { "bPaginate": false } ); }, function () { return document.getElementById('example_paginate') == null; } ); oTest.fnTest( "Information div takes paging disabled into account", null, function () { return document.getElementById('example_info').innerHTML == "Showing 1 to 57 of 57 entries"; } ); /* Enable makes no difference */ oTest.fnTest( "Pagiantion enabled override", function () { oSession.fnRestore(); $('#example').dataTable( { "bPaginate": true } ); }, function () { return document.getElementById('example_paginate') != null; } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/1_dom/bProcessing.js000077500000000000000000000056731265711500300240270ustar00rootroot00000000000000// DATA_TEMPLATE: dom_data oTest.fnStart( "bProcessing" ); /* It's actually a bit hard to set this one due to the fact that it will only be shown * when DataTables is doing some kind of processing. The server-side processing is a bit * better to test this than here - so we just the interal functions to enable it and check * that it is available */ $(document).ready( function () { /* Check the default */ var oTable = $('#example').dataTable(); var oSettings = oTable.fnSettings(); oTest.fnTest( "Processing is off by default", null, function () { return oSettings.oFeatures.bProcessing == false; } ); oTest.fnTest( "Processing div is not in the DOM", function () { oTable.oApi._fnProcessingDisplay( oSettings, true ); }, function () { return document.getElementById('example_processing') == null; } ); oTest.fnTest( "Processing div cannot be shown", function () { oTable.oApi._fnProcessingDisplay( oSettings, true ); }, function () { return document.getElementById('example_processing') == null; } ); oTest.fnTest( "Processing div cannot be hidden", function () { oTable.oApi._fnProcessingDisplay( oSettings, false ); }, function () { return document.getElementById('example_processing') == null; } ); /* Check can disable */ oTest.fnTest( "Processing can be enabled", function () { oSession.fnRestore(); oTable = $('#example').dataTable( { "bProcessing": true } ); oSettings = oTable.fnSettings(); }, function () { return oSettings.oFeatures.bProcessing == true; } ); oTest.fnTest( "Processing div is in the DOM", function () { oTable.oApi._fnProcessingDisplay( oSettings, true ); }, function () { return document.getElementById('example_processing'); } ); oTest.fnTest( "Processing div is hidden by default", function () { oTable.oApi._fnProcessingDisplay( oSettings, true ); }, function () { return document.getElementById('example_processing').style.visibility = "hidden"; } ); oTest.fnTest( "Processing div can be shown", function () { oTable.oApi._fnProcessingDisplay( oSettings, true ); }, function () { return document.getElementById('example_processing').style.visibility = "visible"; } ); oTest.fnTest( "Processing div can be hidden", function () { oTable.oApi._fnProcessingDisplay( oSettings, false ); }, function () { return document.getElementById('example_processing').style.visibility = "hidden"; } ); /* Enable makes no difference */ oTest.fnTest( "Processing disabled override", function () { oSession.fnRestore(); oTable = $('#example').dataTable( { "bProcessing": false } ); oSettings = oTable.fnSettings(); }, function () { return oSettings.oFeatures.bProcessing == false; } ); oTest.fnTest( "Processing div is not in the DOM", function () { oTable.oApi._fnProcessingDisplay( oSettings, true ); }, function () { return document.getElementById('example_processing') == null; } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/1_dom/bServerSide.js000077500000000000000000000006741265711500300237620ustar00rootroot00000000000000// DATA_TEMPLATE: dom_data oTest.fnStart( "bServerSide" ); /* Not interested in server-side processing here other than to check that it is off */ $(document).ready( function () { /* Check the default */ var oTable = $('#example').dataTable(); var oSettings = oTable.fnSettings(); oTest.fnTest( "Server side is off by default", null, function () { return oSettings.oFeatures.bServerSide == false; } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/1_dom/bSort.js000077500000000000000000000047141265711500300226350ustar00rootroot00000000000000// DATA_TEMPLATE: dom_data oTest.fnStart( "bSort" ); $(document).ready( function () { /* Check the default */ $('#example').dataTable(); oTest.fnTest( "Sorting is on by default", null, function () { return $('#example tbody td:eq(0)').html() == "Gecko"; } ); oTest.fnTest( "Sorting Asc by default class applied", null, function () { return $('#example thead th:eq(0)').hasClass("sorting_asc"); } ); oTest.fnTest( "Click on second column", function () { $('#example thead th:eq(1)').click(); }, function () { return $('#example tbody td:eq(1)').html() == "All others"; } ); oTest.fnTest( "Sorting class removed from first column", null, function () { return $('#example thead th:eq(0)').hasClass("sorting_asc") != true; } ); oTest.fnTest( "Sorting asc class applied to second column", null, function () { return $('#example thead th:eq(1)').hasClass("sorting_asc"); } ); oTest.fnTest( "Reverse on second column", function () { $('#example thead th:eq(1)').click(); }, function () { return $('#example tbody td:eq(1)').html() == "Seamonkey 1.1"; } ); oTest.fnTest( "Sorting acs class removed from second column", null, function () { return $('#example thead th:eq(1)').hasClass("sorting_asc") != true; } ); oTest.fnTest( "Sorting desc class applied to second column", null, function () { return $('#example thead th:eq(1)').hasClass("sorting_desc"); } ); /* Check can disable */ oTest.fnTest( "Pagiantion can be disabled", function () { oSession.fnRestore(); $('#example').dataTable( { "bSort": false } ); }, function () { return $('#example tbody td:eq(3)').html() == "4"; } ); oTest.fnTest( "Disabled classes applied", null, function () { return $('#example thead th:eq(0)').hasClass('sorting_disabled'); } ); oTest.fnTest( "Click on second column has no effect", function () { $('#example thead th:eq(1)').click(); }, function () { return $('#example tbody td:eq(3)').html() == "4"; } ); oTest.fnTest( "Reverse on second column has no effect", function () { $('#example thead th:eq(1)').click(); }, function () { return $('#example tbody td:eq(3)').html() == "4"; } ); /* Enable makes no difference */ oTest.fnTest( "Sorting enabled override", function () { oSession.fnRestore(); $('#example').dataTable( { "bSort": true } ); }, function () { return $('#example tbody td:eq(0)').html() == "Gecko"; } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/1_dom/bSortCellsTop.js000077500000000000000000000045021265711500300242760ustar00rootroot00000000000000// DATA_TEMPLATE: dom_data_two_headers oTest.fnStart( "bSortCellsTop" ); $(document).ready( function () { /* Check the default */ var oTable = $('#example').dataTable(); var oSettings = oTable.fnSettings(); oTest.fnTest( "Sorting class is on the bottom cells by default", null, function () { return $('#example thead tr:eq(1) th:eq(0)').hasClass('sorting_asc'); } ); oTest.fnTest( "Sorting is performed on bottom cells", function () { return $('#example thead tr:eq(1) th:eq(0)').click(); }, function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == "Webkit"; } ); oTest.fnTest( "Sorting class is updated on the bottom cells", null, function () { return $('#example thead tr:eq(1) th:eq(0)').hasClass('sorting_desc'); } ); oTest.fnTest( "Clicking on top cells has no effect", function () { return $('#example thead tr:eq(0) th:eq(0)').click(); }, function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == "Webkit"; } ); oTest.fnTest( "Clicking on another top cell has no effect", function () { return $('#example thead tr:eq(0) th:eq(3)').click(); }, function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == "Webkit"; } ); oTest.fnTest( "Sorting class is on the top cell when bSortCellsTop is true", function () { oSession.fnRestore(); $('#example').dataTable( { "bSortCellsTop": true } ); }, function () { return $('#example thead tr:eq(0) th:eq(0)').hasClass('sorting_asc'); } ); oTest.fnTest( "Sorting is performed on top cells now", function () { return $('#example thead tr:eq(0) th:eq(0)').click(); }, function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == "Webkit"; } ); oTest.fnTest( "Sorting class is updated on the top cells", null, function () { return $('#example thead tr:eq(0) th:eq(0)').hasClass('sorting_desc'); } ); oTest.fnTest( "Clicking on bottom cells has no effect", function () { return $('#example thead tr:eq(1) th:eq(0)').click(); }, function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == "Webkit"; } ); oTest.fnTest( "Clicking on another bottom cell has no effect", function () { return $('#example thead tr:eq(1) th:eq(3)').click(); }, function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == "Webkit"; } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/1_dom/bSortClasses.js000077500000000000000000000074071265711500300241550ustar00rootroot00000000000000// DATA_TEMPLATE: dom_data oTest.fnStart( "bSortClasses" ); $(document).ready( function () { /* Check the default */ $('#example').dataTable(); oTest.fnTest( "Sorting classes are applied by default", null, function () { return $('#example tbody tr:eq(0) td:eq(0)').hasClass('sorting_1'); } ); oTest.fnTest( "Sorting classes are applied to all required cells", null, function () { return $('#example tbody tr:eq(7) td:eq(0)').hasClass('sorting_1'); } ); oTest.fnTest( "Sorting classes are not applied to non-sorting columns", null, function () { return $('#example tbody tr:eq(0) td:eq(1)').hasClass('sorting_1') == false; } ); oTest.fnTest( "Sorting multi-column - add column 1", function () { oDispacher.click( $('#example thead th:eq(1)')[0], { 'shift': true } ); }, function () { return $('#example tbody tr:eq(0) td:eq(0)').hasClass('sorting_1') && $('#example tbody tr:eq(0) td:eq(1)').hasClass('sorting_2'); } ); oTest.fnTest( "Sorting multi-column - add column 2", function () { oDispacher.click( $('#example thead th:eq(2)')[0], { 'shift': true } ); }, function () { return $('#example tbody tr:eq(0) td:eq(0)').hasClass('sorting_1') && $('#example tbody tr:eq(0) td:eq(1)').hasClass('sorting_2') && $('#example tbody tr:eq(0) td:eq(2)').hasClass('sorting_3'); } ); oTest.fnTest( "Sorting multi-column - add column 3", function () { oDispacher.click( $('#example thead th:eq(3)')[0], { 'shift': true } ); }, function () { return $('#example tbody tr:eq(0) td:eq(0)').hasClass('sorting_1') && $('#example tbody tr:eq(0) td:eq(1)').hasClass('sorting_2') && $('#example tbody tr:eq(0) td:eq(2)').hasClass('sorting_3') && $('#example tbody tr:eq(0) td:eq(3)').hasClass('sorting_3'); } ); oTest.fnTest( "Remove sorting classes on single column sort", function () { $('#example thead th:eq(4)').click(); }, function () { return $('#example tbody tr:eq(0) td:eq(0)').hasClass('sorting_1') == false && $('#example tbody tr:eq(0) td:eq(1)').hasClass('sorting_2') == false && $('#example tbody tr:eq(0) td:eq(2)').hasClass('sorting_3') == false && $('#example tbody tr:eq(0) td:eq(3)').hasClass('sorting_3') == false; } ); oTest.fnTest( "Sorting class 1 was added", null, function () { return $('#example tbody tr:eq(1) td:eq(4)').hasClass('sorting_1'); } ); /* Check can disable */ oTest.fnTest( "Sorting classes can be disabled", function () { oSession.fnRestore(); $('#example').dataTable( { "bSortClasses": false } ); }, function () { return $('#example tbody tr:eq(0) td:eq(0)').hasClass('sorting_1') == false; } ); oTest.fnTest( "Sorting classes disabled - add column 1 - no effect", function () { oDispacher.click( $('#example thead th:eq(1)')[0], { 'shift': true } ); }, function () { return $('#example tbody tr:eq(0) td:eq(0)').hasClass('sorting_1') == false && $('#example tbody tr:eq(0) td:eq(1)').hasClass('sorting_2') == false; } ); oTest.fnTest( "Sorting classes disabled - add column 2 - no effect", function () { oDispacher.click( $('#example thead th:eq(2)')[0], { 'shift': true } ); }, function () { return $('#example tbody tr:eq(0) td:eq(0)').hasClass('sorting_1') == false && $('#example tbody tr:eq(0) td:eq(1)').hasClass('sorting_2') == false && $('#example tbody tr:eq(0) td:eq(2)').hasClass('sorting_3') == false; } ); /* Enable makes no difference */ oTest.fnTest( "Sorting classes enabled override", function () { oSession.fnRestore(); $('#example').dataTable( { "bSortClasses": true } ); }, function () { return $('#example tbody tr:eq(0) td:eq(0)').hasClass('sorting_1'); } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/1_dom/filtering-types.js000077500000000000000000000055701265711500300246720ustar00rootroot00000000000000// DATA_TEMPLATE: js_data oTest.fnStart( "Filtering works with non-string data" ); $(document).ready( function () { var data = [ { "name": "Tiger Nixon", "position": "", "salary": "$320,800", "start_date": "2011\/04\/25", "office": false, "extn": "5421" }, { "name": "Garrett Winters", "position": "Accountant", "salary": "$170,750", "start_date": "2011\/07\/25", "office": true, "extn": "8422" }, { "name": "Ashton Cox", "position": "Junior Technical Author", "salary": "$86,000", "start_date": "2009\/01\/12", "office": null, "extn": "1562" }, { "name": "Cedric Kelly", "position": "Senior Javascript Developer", "salary": "$433,060", "start_date": "2012\/03\/29", "office": "Edinburgh", "extn": "6224" } ]; var table = $('#example').DataTable( { columns: [ { data: 'name' }, { data: 'position' }, { data: 'salary' }, { data: 'start_date' }, { data: 'office' } ], data: data } ); oTest.fnTest( "Initial load", null, function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == 'Ashton Cox'; } ); oTest.fnTest( "Column string search", function () { table.column( -1 ).search( 'Edinburgh' ).draw(); }, function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == 'Cedric Kelly'; } ); oTest.fnTest( "Column false search", function () { table.column( -1 ).search( false ).draw(); }, function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == 'Tiger Nixon'; } ); oTest.fnTest( "Column true search", function () { table.column( -1 ).search( true ).draw(); }, function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == 'Garrett Winters'; } ); // null is converted to `''` for the filter data but `null` for the search so no matches oTest.fnTest( "Column null search", function () { table.column( -1 ).search( null ).draw(); }, function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == 'No matching records found'; } ); oTest.fnTest( "String search", function () { table.column( -1 ).search( '' ); // clear column search table.search( 'Edinburgh' ).draw(); }, function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == 'Cedric Kelly'; } ); oTest.fnTest( "false search", function () { table.search( false ).draw(); }, function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == 'Tiger Nixon'; } ); oTest.fnTest( "true search", function () { table.search( true ).draw(); }, function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == 'Garrett Winters'; } ); // null is converted to `''` for the filter data but `null` for the search so no matches oTest.fnTest( "null search", function () { table.search( null ).draw(); }, function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == 'No matching records found'; } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/1_dom/fnCreatedCell.js000077500000000000000000000053741265711500300242420ustar00rootroot00000000000000// DATA_TEMPLATE: dom_data oTest.fnStart( "fnCreatedCell tests" ); $(document).ready( function () { var tmp = 0; $('#example').dataTable( { "aoColumnDefs": [ { fnCreatedCell: function () { tmp++; }, "aTargets": ["_all"] } ] } ); oTest.fnTest( "Cell created is called once for each cell on init", null, function () { return tmp===285; } ); oTest.fnTest( "Created isn't called back on other draws", function () { $('#example th:eq(1)').click(); }, function () { return tmp===285; } ); oTest.fnTest( "Four arguments for the function", function () { oSession.fnRestore(); tmp = true; $('#example').dataTable( { "aoColumnDefs": [ { fnCreatedRow: function () { if ( arguments.length !== 4 ) { tmp = false; } }, "aTargets": ["_all"] } ] } ); }, function () { return tmp; } ); oTest.fnTest( "First argument is a TD element", function () { oSession.fnRestore(); tmp = true; $('#example').dataTable( { "aoColumnDefs": [ { fnCreatedRow: function () { if ( arguments[0].nodeName !== "TD" ) { tmp = false; } }, "aTargets": ["_all"] } ] } ); }, function () { return tmp; } ); oTest.fnTest( "Second argument is the HTML value", function () { oSession.fnRestore(); tmp = true; $('#example').dataTable( { "aoColumnDefs": [ { fnCreatedRow: function () { if ( arguments[1] != $('td').html() ) { tmp = false; } }, "aTargets": ["_all"] } ] } ); }, function () { return tmp; } ); oTest.fnTest( "Third argument is the data array", function () { oSession.fnRestore(); tmp = true; $('#example').dataTable( { "aoColumnDefs": [ { fnCreatedRow: function () { if ( arguments[2].length !== 5 ) { tmp = false; } }, "aTargets": ["_all"] } ] } ); }, function () { return tmp; } ); oTest.fnTest( "Fourth argument is the data source for the row", function () { oSession.fnRestore(); tmp = true; $('#example').dataTable( { "aoColumnDefs": [ { fnCreatedRow: function () { if ( arguments[2] !== this.fnSettings().aoData[ arguments[2] ]._aData ) { tmp = false; } }, "aTargets": ["_all"] } ] } ); }, function () { return tmp; } ); oTest.fnTest( "Fifth argument is the the col index", function () { oSession.fnRestore(); tmp = true; $('#example').dataTable( { "aoColumnDefs": [ { fnCreatedRow: function () { if ( arguments[1] != $('td:eq('+arguments[4]+')', arguments[0].parentNode).html() ) { tmp = false; } }, "aTargets": ["_all"] } ] } ); }, function () { return tmp; } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/1_dom/fnCreatedRow.js000077500000000000000000000040671265711500300241300ustar00rootroot00000000000000// DATA_TEMPLATE: dom_data oTest.fnStart( "fnCreatedRow tests" ); $(document).ready( function () { var tmp = 0; $('#example').dataTable( { fnCreatedRow: function () { tmp++; } } ); oTest.fnTest( "Row created is called once for each row on init", null, function () { return tmp===57; } ); oTest.fnTest( "Created isn't called back on other draws", function () { $('#example th:eq(1)').click(); }, function () { return tmp===57; } ); oTest.fnTest( "Three arguments for the function", function () { oSession.fnRestore(); tmp = true; $('#example').dataTable( { fnCreatedRow: function () { if ( arguments.length !== 3 ) { tmp = false; } } } ); }, function () { return tmp; } ); oTest.fnTest( "First argument is a TR element", function () { oSession.fnRestore(); tmp = true; $('#example').dataTable( { fnCreatedRow: function () { if ( arguments[0].nodeName !== "TR" ) { tmp = false; } } } ); }, function () { return tmp; } ); oTest.fnTest( "Second argument is an array with 5 elements", function () { oSession.fnRestore(); tmp = true; $('#example').dataTable( { fnCreatedRow: function () { if ( arguments[1].length !== 5 ) { tmp = false; } } } ); }, function () { return tmp; } ); oTest.fnTest( "Third argument is the data source for the row", function () { oSession.fnRestore(); tmp = true; $('#example').dataTable( { fnCreatedRow: function () { if ( arguments[1] !== this.fnSettings().aoData[ arguments[2] ]._aData ) { tmp = false; } } } ); }, function () { return tmp; } ); oTest.fnTest( "TR element is tied to the correct data", function () { oSession.fnRestore(); tmp = false; $('#example').dataTable( { fnCreatedRow: function (tr, data, index) { if ( data[1] === "Firefox 1.0" ) { if ( $('td:eq(3)', tr).html() == "1.7" ) { tmp = true; } } } } ); }, function () { return tmp; } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/1_dom/fnDeleteRow.js000077500000000000000000000014321265711500300237540ustar00rootroot00000000000000// DATA_TEMPLATE: dom_data oTest.fnStart( "fnDeleteRow" ); $(document).ready( function () { /* Check the default */ var oTable = $('#example').dataTable(); var oSettings = oTable.fnSettings(); oTest.fnTest( "Check that the default data is sane", null, function () { return $('#example tbody td:eq(1)').text() == 'Firefox 1.0'; } ); oTest.fnTest( "Remove the first data row, and check that hte search data has been updated", function () { oTable.fnDeleteRow( $('#example tbody tr')[0] ); }, function () { return $('#example tbody td:eq(1)').text() == 'Firefox 1.5'; } ); oTest.fnTest( "Check that the info element has been updated", null, function () { return $('#example_info').html() == "Showing 1 to 10 of 56 entries"; } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/1_dom/fnDrawCallback.js000077500000000000000000000027121265711500300243760ustar00rootroot00000000000000// DATA_TEMPLATE: dom_data oTest.fnStart( "fnDrawCallback" ); /* Fairly boring function compared to the others! */ $(document).ready( function () { /* Check the default */ var oTable = $('#example').dataTable(); var oSettings = oTable.fnSettings(); var mPass; oTest.fnTest( "Default should be null", null, function () { return oSettings.fnDrawCallback == null; } ); oTest.fnTest( "One argument passed", function () { oSession.fnRestore(); mPass = -1; $('#example').dataTable( { "fnDrawCallback": function ( ) { mPass = arguments.length; } } ); }, function () { return mPass == 1; } ); oTest.fnTest( "That one argument is the settings object", function () { oSession.fnRestore(); oTable = $('#example').dataTable( { "fnDrawCallback": function ( oSettings ) { mPass = oSettings; } } ); }, function () { return oTable.fnSettings() == mPass; } ); oTest.fnTest( "fnRowCallback called once on first draw", function () { oSession.fnRestore(); mPass = 0; $('#example').dataTable( { "fnDrawCallback": function ( ) { mPass++; } } ); }, function () { return mPass == 1; } ); oTest.fnTest( "fnRowCallback called once on each draw there after as well", function () { $('#example_next').click(); $('#example_next').click(); $('#example_next').click(); }, function () { return mPass == 4; } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/1_dom/fnFilter.js000077500000000000000000000006221265711500300233070ustar00rootroot00000000000000// DATA_TEMPLATE: dom_data oTest.fnStart( "fnFilter" ); $(document).ready( function () { /* Check the default */ var oTable = $('#example').dataTable(); oTable.fnFilter(1); oTest.fnTest( "Filtering with a non-string input is valid", null, function () { return $('#example_info').html() == "Showing 1 to 10 of 32 entries (filtered from 57 total entries)"; } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/1_dom/fnFooterCallback.js000077500000000000000000000106541265711500300247430ustar00rootroot00000000000000// DATA_TEMPLATE: dom_data oTest.fnStart( "fnFooterCallback" ); $(document).ready( function () { /* Check the default */ var oTable = $('#example').dataTable(); var oSettings = oTable.fnSettings(); var mPass; oTest.fnTest( "Default should be null", null, function () { return oSettings.fnFooterCallback == null; } ); oTest.fnTest( "Five arguments passed", function () { oSession.fnRestore(); mPass = -1; $('#example').dataTable( { "fnFooterCallback": function ( ) { mPass = arguments.length; } } ); }, function () { return mPass == 5; } ); oTest.fnTest( "fnRowCallback called once per draw", function () { oSession.fnRestore(); mPass = 0; $('#example').dataTable( { "fnFooterCallback": function ( nFoot, aasData, iStart, iEnd, aiDisplay ) { mPass++; } } ); }, function () { return mPass == 1; } ); oTest.fnTest( "fnRowCallback called on paging (i.e. another draw)", function () { $('#example_next').click(); }, function () { return mPass == 2; } ); oTest.fnTest( "fnRowCallback allows us to alter row information", function () { oSession.fnRestore(); $('#example').dataTable( { "fnFooterCallback": function ( nFoot, aasData, iStart, iEnd, aiDisplay ) { nFoot.getElementsByTagName('th')[0].innerHTML = "Displaying "+(iEnd-iStart)+" records"; } } ); }, function () { return $('#example tfoot th:eq(0)').html() == "Displaying 10 records"; } ); oTest.fnTest( "Data array has length matching original data", function () { oSession.fnRestore(); mPass = true; $('#example').dataTable( { "fnFooterCallback": function ( nFoot, aasData, iStart, iEnd, aiDisplay ) { if ( aasData.length != 57 ) { mPass = false; } } } ); }, function () { return mPass; } ); oTest.fnTest( "Data array's column lengths match original data", function () { oSession.fnRestore(); mPass = true; $('#example').dataTable( { "fnFooterCallback": function ( nFoot, aasData, iStart, iEnd, aiDisplay ) { for ( var i=0, iLen=aasData.length ; i' } ); oSettings = oTable.fnSettings(); }, function () { return oSettings.sDom == '<"wrapper"flipt>'; } ); oTest.fnTest( "Check example 1 in DOM", null, function () { var jqNodes = $('#demo div, #demo table'); var nNodes = []; /* Strip the paging nodes */ for ( var i=0, iLen=jqNodes.length ; iip>' } ); }, function () { var jqNodes = $('#demo div, #demo table'); var nNodes = []; var nCustomWrappers = [] /* Strip the paging nodes */ for ( var i=0, iLen=jqNodes.length ; irti' } ); }, function () { return $('#test').length == 1; } ); oTest.fnTest( "Element with an id and a class", function () { $('#example').dataTable( { "bDestroy": true, "sDom": '<"#test.classTest"lf>rti' } ); }, function () { return ($('#test').length == 1 && $('#test')[0].className == "classTest"); } ); oTest.fnTest( "Element with just a class", function () { $('#example').dataTable( { "bDestroy": true, "sDom": '<"classTest"lf>rti' } ); }, function () { return ($('div.classTest').length == 1 ); } ); oTest.fnTest( "Two elements with an id", function () { $('#example').dataTable( { "bDestroy": true, "sDom": '<"#test1"lf>rti<"#test2"lf>' } ); }, function () { return ($('#test1').length == 1 && $('#test2').length == 1); } ); oTest.fnTest( "Two elements with an id and one with a class", function () { $('#example').dataTable( { "bDestroy": true, "sDom": '<"#test1"lf>rti<"#test2.classTest"lf>' } ); }, function () { return ($('#test1').length == 1 && $('#test2').length == 1 && $('div.classTest').length == 1); } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/1_dom/sPaginationType.js000077500000000000000000000055721265711500300246650ustar00rootroot00000000000000// DATA_TEMPLATE: dom_data oTest.fnStart( "sPaginationType" ); $(document).ready( function () { /* Check the default */ var oTable = $('#example').dataTable(); var oSettings = oTable.fnSettings(); oTest.fnTest( "Check simple numbers paging is the default", null, function () { return oSettings.sPaginationType == "simple_numbers"; } ); oTest.fnTest( "Check class is applied", null, function () { return $('#example_paginate').hasClass('paging_simple_numbers'); } ); oTest.fnTest( "8 A elements are in the wrapper for test data", null, function () { return $('#example_paginate a').length == 8; } ); oTest.fnTest( "We have the previous button", null, function () { return document.getElementById('example_previous'); } ); oTest.fnTest( "We have the next button", null, function () { return document.getElementById('example_next'); } ); oTest.fnTest( "Previous button is disabled", null, function () { return $('#example_previous').hasClass('disabled'); } ); oTest.fnTest( "Next button is enabled", null, function () { return ! $('#example_next').hasClass('disabled'); } ); /* Don't test paging - that's done by the zero config test script. */ /* Full buttons paging */ oTest.fnTest( "Can enabled full numbers paging", function () { oSession.fnRestore(); oTable = $('#example').dataTable( { "sPaginationType": "full_numbers" } ); oSettings = oTable.fnSettings(); }, function () { return oSettings.sPaginationType == "full_numbers"; } ); oTest.fnTest( "Check full numbers class is applied", null, function () { return $('#example_paginate').hasClass('paging_full_numbers'); } ); var nFirst, nPrevious, nNext, nLast; oTest.fnTest( "Jump to last page", function () { nFirst = $('div.dataTables_paginate a.first'); nPrevious = $('div.dataTables_paginate a.previous'); nNext = $('div.dataTables_paginate a.next'); nLast = $('div.dataTables_paginate a.last'); nLast.click(); }, function () { return document.getElementById('example_info').innerHTML == "Showing 51 to 57 of 57 entries"; } ); oTest.fnTest( "Go to two pages previous", function () { $('div.dataTables_paginate a.previous').click(); $('div.dataTables_paginate a.previous').click(); }, function () { return document.getElementById('example_info').innerHTML == "Showing 31 to 40 of 57 entries"; } ); oTest.fnTest( "Next (second last) page", function () { $('div.dataTables_paginate a.next').click(); }, function () { return document.getElementById('example_info').innerHTML == "Showing 41 to 50 of 57 entries"; } ); oTest.fnTest( "Jump to first page", function () { $('div.dataTables_paginate a.first').click(); }, function () { return document.getElementById('example_info').innerHTML == "Showing 1 to 10 of 57 entries"; } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/1_dom/sScrollXY.js000077500000000000000000000041651265711500300234460ustar00rootroot00000000000000// DATA_TEMPLATE: dom_data oTest.fnStart( "sScrollX / Y" ); $(document).ready( function () { // Force some x scrolling $('body').css('white-space', 'nowrap'); $('#container').css('width', '400px'); var oTable = $('#example').dataTable( { "sScrollX": "100%", "sScrollY": "200px", "bPaginate": false } ); oTest.fnWaitTest( "Header follows x-scrolling", function () { $('div.dataTables_scrollBody').scrollLeft(20); }, function () { return $('div.dataTables_scrollHead').scrollLeft() == 20; } ); oTest.fnWaitTest( "Footer follows x-scrolling", null, function () { return $('div.dataTables_scrollFoot').scrollLeft() == 20; } ); oTest.fnWaitTest( "y-scrolling has no effect on header", function () { $('div.dataTables_scrollBody').scrollTop(20); }, function () { return $('div.dataTables_scrollHead').scrollLeft() == 20; } ); oTest.fnWaitTest( "Filtering results in sets y-scroll back to 0", function () { oTable.fnFilter('1') }, function () { return $('div.dataTables_scrollBody').scrollTop() == 0; } ); oTest.fnWaitTest( "Filtering has no effect on x-scroll", null, function () { return $('div.dataTables_scrollBody').scrollLeft() == 20; } ); oTest.fnWaitTest( "Full x-scroll has header track all the way with it", function () { $('div.dataTables_scrollBody').scrollLeft( $('#example').width() - $('div.dataTables_scrollBody')[0].clientWidth ); }, function () { return $('div.dataTables_scrollBody').scrollLeft() == $('div.dataTables_scrollHead').scrollLeft(); } ); oTest.fnTest( "Footer also tracked all the way", null, function () { return $('div.dataTables_scrollBody').scrollLeft() == $('div.dataTables_scrollFoot').scrollLeft(); } ); oTest.fnTest( "Don't throw an error if initialising again on id selected element", function () { $('#example').dataTable(); }, function () { return true; } ); oTest.fnTest( "Don't throw an error if initialising again on tag name selected element - picking up header table as well", function () { $('table.dataTable').dataTable(); }, function () { return true; } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/1_dom/th_in_body.js000077500000000000000000000320531265711500300236570ustar00rootroot00000000000000// DATA_TEMPLATE: dom_data_th oTest.fnStart( "Sanity checks for DataTables with DOM data and a TH in the body" ); oTest.fnTest( "jQuery.dataTable function", null, function () { return typeof jQuery().dataTable == "function"; } ); oTest.fnTest( "jQuery.dataTableSettings storage array", null, function () { return typeof jQuery().dataTableSettings == "object"; } ); oTest.fnTest( "jQuery.dataTableExt plugin object", null, function () { return typeof jQuery().dataTableExt == "object"; } ); $(document).ready( function () { $('#example').dataTable(); /* Basic checks */ oTest.fnTest( "Length changing div exists", null, function () { return document.getElementById('example_length') != null; } ); oTest.fnTest( "Filtering div exists", null, function () { return document.getElementById('example_filter') != null; } ); oTest.fnTest( "Information div exists", null, function () { return document.getElementById('example_info') != null; } ); oTest.fnTest( "Pagination div exists", null, function () { return document.getElementById('example_paginate') != null; } ); oTest.fnTest( "Processing div is off by default", null, function () { return document.getElementById('example_processing') == null; } ); oTest.fnTest( "10 rows shown on the first page", null, function () { return $('#example tbody tr').length == 10; } ); oTest.fnTest( "Initial sort occured", null, function () { return $('#example tbody td:eq(0)').html() == "Gecko"; } ); /* Need to use the WaitTest for sorting due to the setTimeout datatables uses */ oTest.fnTest( "Sorting (first click) on second column", function () { $('#example thead th:eq(1)').click(); }, function () { return $('#example tbody td:eq(1)').html() == "All others"; } ); oTest.fnTest( "Sorting (second click) on second column", function () { $('#example thead th:eq(1)').click(); }, function () { return $('#example tbody td:eq(1)').html() == "Seamonkey 1.1"; } ); oTest.fnTest( "Sorting (third click) on second column", function () { $('#example thead th:eq(1)').click(); }, function () { return $('#example tbody td:eq(1)').html() == "All others"; } ); oTest.fnTest( "Sorting (first click) on numeric column", function () { $('#example thead th:eq(3)').click(); }, function () { return $('#example tbody td:eq(3)').html() == "-"; } ); oTest.fnTest( "Sorting (second click) on numeric column", function () { $('#example thead th:eq(3)').click(); }, function () { return $('#example tbody td:eq(3)').html() == "522.1"; } ); oTest.fnTest( "Sorting multi-column (first click)", function () { $('#example thead th:eq(0)').click(); oDispacher.click( $('#example thead th:eq(1)')[0], { 'shift': true } ); }, function () { var b = $('#example tbody td:eq(0)').html() == "Gecko" && $('#example tbody td:eq(1)').html() == "Camino 1.0"; return b; } ); oTest.fnTest( "Sorting multi-column - sorting second column only", function () { $('#example thead th:eq(1)').click(); }, function () { return $('#example tbody td:eq(1)').html() == "All others"; } ); /* Basic paging */ oTest.fnTest( "Paging to second page", function () { $('#example_next').click(); }, function () { return $('#example tbody td:eq(1)').html() == "IE Mobile"; } ); oTest.fnTest( "Paging to first page", function () { $('#example_previous').click(); }, function () { return $('#example tbody td:eq(1)').html() == "All others"; } ); oTest.fnTest( "Attempting to page back beyond the first page", function () { $('#example_previous').click(); }, function () { return $('#example tbody td:eq(1)').html() == "All others"; } ); /* Changing length */ oTest.fnTest( "Changing table length to 25 records", function () { $("select[name=example_length]").val('25').change(); }, function () { return $('#example tbody tr').length == 25; } ); oTest.fnTest( "Changing table length to 50 records", function () { $("select[name=example_length]").val('50').change(); }, function () { return $('#example tbody tr').length == 50; } ); oTest.fnTest( "Changing table length to 100 records", function () { $("select[name=example_length]").val('100').change(); }, function () { return $('#example tbody tr').length == 57; } ); oTest.fnTest( "Changing table length to 10 records", function () { $("select[name=example_length]").val('10').change(); }, function () { return $('#example tbody tr').length == 10; } ); /* * Information element */ oTest.fnTest( "Information on zero config", null, function () { return document.getElementById('example_info').innerHTML == "Showing 1 to 10 of 57 entries"; } ); oTest.fnTest( "Information on second page", function () { $('#example_next').click(); }, function () { return document.getElementById('example_info').innerHTML == "Showing 11 to 20 of 57 entries"; } ); oTest.fnTest( "Information on third page", function () { $('#example_next').click(); }, function () { return document.getElementById('example_info').innerHTML == "Showing 21 to 30 of 57 entries"; } ); oTest.fnTest( "Information on last page", function () { $('#example_next').click(); $('#example_next').click(); $('#example_next').click(); }, function () { return document.getElementById('example_info').innerHTML == "Showing 51 to 57 of 57 entries"; } ); oTest.fnTest( "Information back on first page", function () { $('#example_previous').click(); $('#example_previous').click(); $('#example_previous').click(); $('#example_previous').click(); $('#example_previous').click(); }, function () { return document.getElementById('example_info').innerHTML == "Showing 1 to 10 of 57 entries"; } ); oTest.fnTest( "Information with 25 records", function () { $("select[name=example_length]").val('25').change(); }, function () { return document.getElementById('example_info').innerHTML == "Showing 1 to 25 of 57 entries"; } ); oTest.fnTest( "Information with 25 records - second page", function () { $('#example_next').click(); }, function () { return document.getElementById('example_info').innerHTML == "Showing 26 to 50 of 57 entries"; } ); oTest.fnTest( "Information with 100 records - first page", function () { $('#example_previous').click(); $("select[name=example_length]").val('100').change(); }, function () { return document.getElementById('example_info').innerHTML == "Showing 1 to 57 of 57 entries"; } ); oTest.fnTest( "Information back to 10 records", function () { $('#example_previous').click(); $("select[name=example_length]").val('10').change(); }, function () { return document.getElementById('example_info').innerHTML == "Showing 1 to 10 of 57 entries"; } ); oTest.fnTest( "Information with filter 'Win'", function () { $('#example_filter input').val("Win").keyup(); }, function () { return document.getElementById('example_info').innerHTML == "Showing 1 to 10 of 31 entries (filtered from 57 total entries)"; } ); oTest.fnTest( "Information with filter 'Win' second page", function () { $('#example_next').click(); }, function () { return document.getElementById('example_info').innerHTML == "Showing 11 to 20 of 31 entries (filtered from 57 total entries)"; } ); oTest.fnTest( "Information with filter 'Win' last page", function () { $('#example_next').click(); $('#example_next').click(); }, function () { return document.getElementById('example_info').innerHTML == "Showing 31 to 31 of 31 entries (filtered from 57 total entries)"; } ); oTest.fnTest( "Information with filter 'Win' back to first page", function () { $('#example_previous').click(); $('#example_previous').click(); $('#example_previous').click(); }, function () { return document.getElementById('example_info').innerHTML == "Showing 1 to 10 of 31 entries (filtered from 57 total entries)"; } ); oTest.fnTest( "Information with filter 'Win' second page - second time", function () { $('#example_next').click(); }, function () { return document.getElementById('example_info').innerHTML == "Showing 11 to 20 of 31 entries (filtered from 57 total entries)"; } ); oTest.fnTest( "Information with filter increased to 'Win 98'", function () { $('#example_filter input').val("Win 98").keyup(); }, function () { return document.getElementById('example_info').innerHTML == "Showing 1 to 9 of 9 entries (filtered from 57 total entries)"; } ); oTest.fnTest( "Information with filter decreased to 'Win'", function () { $('#example_filter input').val("Win").keyup(); }, function () { return document.getElementById('example_info').innerHTML == "Showing 1 to 10 of 31 entries (filtered from 57 total entries)"; } ); oTest.fnTest( "Information with filter 'Win' second page - third time", function () { $('#example_next').click(); }, function () { return document.getElementById('example_info').innerHTML == "Showing 11 to 20 of 31 entries (filtered from 57 total entries)"; } ); oTest.fnTest( "Information with filter removed", function () { $('#example_filter input').val("").keyup(); }, function () { return document.getElementById('example_info').innerHTML == "Showing 1 to 10 of 57 entries"; } ); /* * Filtering */ oTest.fnTest( "Filter 'W' - rows", function () { /* Reset the table such that the old sorting doesn't mess things up */ oSession.fnRestore(); $('#example').dataTable(); $('#example_filter input').val("W").keyup(); }, function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == "Gecko"; } ); oTest.fnTest( "Filter 'W' - info", null, function () { return document.getElementById('example_info').innerHTML == "Showing 1 to 10 of 42 entries (filtered from 57 total entries)"; } ); oTest.fnTest( "Filter 'Wi'", function () { $('#example_filter input').val("Wi").keyup(); }, function () { return document.getElementById('example_info').innerHTML == "Showing 1 to 10 of 32 entries (filtered from 57 total entries)"; } ); oTest.fnTest( "Filter 'Win'", function () { $('#example_filter input').val("Win").keyup(); }, function () { return document.getElementById('example_info').innerHTML == "Showing 1 to 10 of 31 entries (filtered from 57 total entries)"; } ); oTest.fnTest( "Filter 'Win' - sorting column 1", function () { $('#example thead th:eq(1)').click(); }, function () { return $('#example tbody tr:eq(0) td:eq(1)').html() == "AOL browser (AOL desktop)"; } ); oTest.fnTest( "Filter 'Win' - sorting column 1 info", null, function () { return document.getElementById('example_info').innerHTML == "Showing 1 to 10 of 31 entries (filtered from 57 total entries)"; } ); oTest.fnTest( "Filter 'Win' - sorting column 1 reverse", function () { $('#example thead th:eq(1)').click(); }, function () { return $('#example tbody tr:eq(0) td:eq(1)').html() == "Seamonkey 1.1"; } ); oTest.fnTest( "Filter 'Win XP' - maintaing reverse sorting col 1", function () { $('#example_filter input').val("Win XP").keyup(); }, function () { return $('#example tbody tr:eq(0) td:eq(1)').html() == "Internet Explorer 7"; } ); oTest.fnTest( "Filter 'Win XP' - sorting col 3", function () { $('#example thead th:eq(3)').click(); }, function () { return $('#example tbody tr:eq(0) td:eq(3)').html() == "4"; } ); oTest.fnTest( "Filter 'Win XP' - sorting col 3 - reversed", function () { $('#example thead th:eq(3)').click(); }, function () { return $('#example tbody tr:eq(0) td:eq(3)').html() == "7"; } ); oTest.fnTest( "Filter 'Win' - sorting col 3 - reversed info", null, function () { return document.getElementById('example_info').innerHTML == "Showing 1 to 6 of 6 entries (filtered from 57 total entries)"; } ); oTest.fnTest( "Filter 'nothinghere'", function () { $('#example_filter input').val("nothinghere").keyup(); }, function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == "No matching records found"; } ); oTest.fnTest( "Filter 'nothinghere' - info", null, function () { return document.getElementById('example_info').innerHTML == "Showing 0 to 0 of 0 entries (filtered from 57 total entries)"; } ); oTest.fnTest( "Filter back to blank and 1st column sorting", function () { $('#example_filter input').val("").keyup(); $('#example thead th:eq(0)').click(); }, function () { return document.getElementById('example_info').innerHTML == "Showing 1 to 10 of 57 entries"; } ); oTest.fnTest( "Prefixing a filter entry", function () { $('#example_filter input').val("Win").keyup(); $('#example_filter input').val("GeckoWin").keyup(); }, function () { return document.getElementById('example_info').innerHTML == "Showing 0 to 0 of 0 entries (filtered from 57 total entries)"; } ); oTest.fnTest( "Prefixing a filter entry with space", function () { $('#example_filter input').val("Gecko Win").keyup(); }, function () { return document.getElementById('example_info').innerHTML == "Showing 1 to 10 of 17 entries (filtered from 57 total entries)"; } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/2_js/000077500000000000000000000000001265711500300210335ustar00rootroot00000000000000DataTablesSrc-1.10.11/tests/tests_onhold/2_js/39-nested-null.js000066400000000000000000000030221265711500300240510ustar00rootroot00000000000000// DATA_TEMPLATE: empty_table oTest.fnStart( "39 - nested null values" ); $(document).ready( function () { var test = false; $.fn.dataTable.ext.sErrMode = "throw"; oTest.fnTest( "No default content throws an error", function () { try { $('#example').dataTable( { "aaData": [ { "a": "0", "b": {"c": 0} }, { "a": "1", "b": {"c": 3} }, { "a": "2", "b": null } ], "aoColumns": [ { "mDataProp": "a" }, { "mDataProp": "b" }, { "mDataProp": "b.c" } ] } ); } catch(err) { test = true; } }, function () { return test; } ); oTest.fnTest( "Table renders", function () { oSession.fnRestore(); $('#example').dataTable( { "aaData": [ { "a": "0", "b": {"c": 0} }, { "a": "1", "b": {"c": 3} }, { "a": "2", "b": null } ], "aoColumns": [ { "mDataProp": "a" }, { "mDataProp": "b" }, { "mDataProp": "b.c", "sDefaultContent": "allan" } ] } ); }, function () { return $('#example tbody td:eq(0)').html() === "0"; } ); oTest.fnTest( "Default content applied", function () { oSession.fnRestore(); $('#example').dataTable( { "aaData": [ { "a": "0", "b": {"c": 0} }, { "a": "1", "b": {"c": 3} }, { "a": "2", "b": null } ], "aoColumns": [ { "mDataProp": "a" }, { "mDataProp": "b" }, { "mDataProp": "b.c", "sDefaultContent": "allan" } ] } ); }, function () { return $('#example tbody td:eq(8)').html() === "allan"; } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/2_js/6872-default-content-missing-props.js000066400000000000000000000126021265711500300277020ustar00rootroot00000000000000// DATA_TEMPLATE: empty_table oTest.fnStart( "6872 - mDataProp and sDefaultContent for deep objects" ); $(document).ready( function () { var test = false; $.fn.dataTable.ext.sErrMode = "throw"; /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Shallow properties */ $('#example').dataTable( { "aaData": [ { "a": "a", "b": "b", "c": "c", "d": "d", "e": "e" } ], "aoColumns": [ { "mDataProp": "a" }, { "mDataProp": "b" }, { "mDataProp": "c" }, { "mDataProp": "d" }, { "mDataProp": "e" } ] } ); oTest.fnTest( "Basic initialisation of objects works", null, function () { return $('#example tbody td:eq(0)').html() === "a"; } ); oTest.fnTest( "Error when property missing (no default content)", function () { oSession.fnRestore(); test = false; try { $('#example').dataTable( { "aaData": [ { "a": "a", "b": "b", "d": "d", "e": "e" } ], "aoColumns": [ { "mDataProp": "a" }, { "mDataProp": "b" }, { "mDataProp": "c" }, { "mDataProp": "d" }, { "mDataProp": "e" } ] } ); } catch (e) { test = true; } }, function () { return test; } ); oTest.fnTest( "Default content used for missing prop and no error", function () { oSession.fnRestore(); $('#example').dataTable( { "aaData": [ { "a": "a", "b": "b", "d": "d", "e": "e" } ], "aoColumns": [ { "mDataProp": "a" }, { "mDataProp": "b" }, { "mDataProp": "c", "sDefaultContent": "test" }, { "mDataProp": "d" }, { "mDataProp": "e" } ] } ); }, function () { return $('#example tbody td:eq(2)').html() === "test"; } ); /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Deep properties with a single object */ oTest.fnTest( "Basic test with deep properties", function () { oSession.fnRestore(); $('#example').dataTable( { "aaData": [ { "z": { "a": "a", "b": "b", "c": "c", "d": "d", "e": "e" } } ], "aoColumns": [ { "mDataProp": "z.a" }, { "mDataProp": "z.b" }, { "mDataProp": "z.c" }, { "mDataProp": "z.d" }, { "mDataProp": "z.e" } ] } ); }, function () { return $('#example tbody td:eq(0)').html() === "a"; } ); oTest.fnTest( "Error when property missing on deep get (no default content)", function () { oSession.fnRestore(); test = false; try { $('#example').dataTable( { "aaData": [ { "z": { "a": "a", "b": "b", "c": "c", "e": "e" } } ], "aoColumns": [ { "mDataProp": "z.a" }, { "mDataProp": "z.b" }, { "mDataProp": "z.c" }, { "mDataProp": "z.d" }, { "mDataProp": "z.e" } ] } ); } catch (e) { test = true; } }, function () { return test; } ); oTest.fnTest( "Default content used for missing prop on deep get and no error", function () { oSession.fnRestore(); $('#example').dataTable( { "aaData": [ { "z": { "a": "a", "b": "b", "c": "c", "e": "e" } } ], "aoColumns": [ { "mDataProp": "z.a" }, { "mDataProp": "z.b" }, { "mDataProp": "z.c" }, { "mDataProp": "z.d", "sDefaultContent": "test" }, { "mDataProp": "z.e" } ] } ); }, function () { return $('#example tbody td:eq(3)').html() === "test"; } ); /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Deep properties with individual objects */ oTest.fnTest( "Basic test with deep individual properties", function () { oSession.fnRestore(); $('#example').dataTable( { "aaData": [ { "m": { "a": "a" }, "n": { "b": "b" }, "o": { "c": "c" }, "p": { "d": "d" }, "q": { "e": "e" } } ], "aoColumns": [ { "mDataProp": "m.a" }, { "mDataProp": "n.b" }, { "mDataProp": "o.c" }, { "mDataProp": "p.d" }, { "mDataProp": "q.e" } ] } ); }, function () { return $('#example tbody td:eq(0)').html() === "a"; } ); oTest.fnTest( "Error when property missing on deep individual get (no default content)", function () { oSession.fnRestore(); test = false; try { $('#example').dataTable( { "aaData": [ { "m": { "a": "a" }, "n": { "b": "b" }, "p": { "d": "d" }, "q": { "e": "e" } } ], "aoColumns": [ { "mDataProp": "m.a" }, { "mDataProp": "n.b" }, { "mDataProp": "o.c" }, { "mDataProp": "p.d" }, { "mDataProp": "q.e" } ] } ); } catch (e) { test = true; } }, function () { return test; } ); oTest.fnTest( "Default content used for missing prop on deep individual get and no error", function () { oSession.fnRestore(); $('#example').dataTable( { "aaData": [ { "m": { "a": "a" }, "n": { "b": "b" }, "p": { "d": "d" }, "q": { "e": "e" } } ], "aoColumns": [ { "mDataProp": "m.a" }, { "mDataProp": "n.b" }, { "mDataProp": "o.c", "sDefaultContent": "test" }, { "mDataProp": "p.d" }, { "mDataProp": "q.e" } ] } ); }, function () { return $('#example tbody td:eq(2)').html() === "test"; } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/2_js/8549--string-sorting-nonstrings.js000066400000000000000000000015701265711500300272530ustar00rootroot00000000000000// DATA_TEMPLATE: empty_table oTest.fnStart( "8549 - string sorting non-string types" ); $(document).ready( function () { var test = false; $.fn.dataTable.ext.sErrMode = "throw"; /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Shallow properties */ $('#example').dataTable( { "aaData": [ [ null ], [ 5 ], [ "1a" ], [ new Date(0) ] ], "aoColumns": [ { "sTitle": "Test" } ] } ); oTest.fnTest( "Sorting works - first cell is empty", null, function () { return $('#example tbody tr:eq(0) td:eq(0)').html() === ""; } ); oTest.fnTest( "Second cell is 1a", null, function () { return $('#example tbody tr:eq(1) td:eq(0)').html() === "1a"; } ); oTest.fnTest( "Third cell is 5", null, function () { return $('#example tbody tr:eq(2) td:eq(0)').html() === "5"; } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/2_js/_zero_config.js000066400000000000000000000321131265711500300240340ustar00rootroot00000000000000// DATA_TEMPLATE: js_data oTest.fnStart( "Sanity checks for DataTables with data from JS" ); oTest.fnTest( "jQuery.dataTable function", null, function () { return typeof jQuery().dataTable == "function"; } ); oTest.fnTest( "jQuery.dataTableSettings storage array", null, function () { return typeof jQuery().dataTableSettings == "object"; } ); oTest.fnTest( "jQuery.dataTableExt plugin object", null, function () { return typeof jQuery().dataTableExt == "object"; } ); $(document).ready( function () { var oInit = { "aaData": gaaData }; $('#example').dataTable( oInit ); /* Basic checks */ oTest.fnTest( "Length changing div exists", null, function () { return document.getElementById('example_length') != null; } ); oTest.fnTest( "Filtering div exists", null, function () { return document.getElementById('example_filter') != null; } ); oTest.fnTest( "Information div exists", null, function () { return document.getElementById('example_info') != null; } ); oTest.fnTest( "Pagination div exists", null, function () { return document.getElementById('example_paginate') != null; } ); oTest.fnTest( "Processing div is off by default", null, function () { return document.getElementById('example_processing') == null; } ); oTest.fnTest( "10 rows shown on the first page", null, function () { return $('#example tbody tr').length == 10; } ); oTest.fnTest( "Initial sort occured", null, function () { return $('#example tbody td:eq(0)').html() == "Gecko"; } ); /* Need to use the WaitTest for sorting due to the setTimeout datatables uses */ oTest.fnTest( "Sorting (first click) on second column", function () { $('#example thead th:eq(1)').click(); }, function () { return $('#example tbody td:eq(1)').html() == "All others"; } ); oTest.fnTest( "Sorting (second click) on second column", function () { $('#example thead th:eq(1)').click(); }, function () { return $('#example tbody td:eq(1)').html() == "Seamonkey 1.1"; } ); oTest.fnTest( "Sorting (third click) on second column", function () { $('#example thead th:eq(1)').click(); }, function () { return $('#example tbody td:eq(1)').html() == "All others"; } ); oTest.fnTest( "Sorting (first click) on numeric column", function () { $('#example thead th:eq(3)').click(); }, function () { return $('#example tbody td:eq(3)').html() == "-"; } ); oTest.fnTest( "Sorting (second click) on numeric column", function () { $('#example thead th:eq(3)').click(); }, function () { return $('#example tbody td:eq(3)').html() == "522.1"; } ); oTest.fnTest( "Sorting multi-column (first click)", function () { $('#example thead th:eq(0)').click(); oDispacher.click( $('#example thead th:eq(1)')[0], { 'shift': true } ); }, function () { var b = $('#example tbody td:eq(0)').html() == "Gecko" && $('#example tbody td:eq(1)').html() == "Camino 1.0"; return b; } ); oTest.fnTest( "Sorting multi-column - sorting second column only", function () { $('#example thead th:eq(1)').click(); }, function () { return $('#example tbody td:eq(1)').html() == "All others"; } ); /* Basic paging */ oTest.fnTest( "Paging to second page", function () { $('#example_next').click(); }, function () { return $('#example tbody td:eq(1)').html() == "IE Mobile"; } ); oTest.fnTest( "Paging to first page", function () { $('#example_previous').click(); }, function () { return $('#example tbody td:eq(1)').html() == "All others"; } ); oTest.fnTest( "Attempting to page back beyond the first page", function () { $('#example_previous').click(); }, function () { return $('#example tbody td:eq(1)').html() == "All others"; } ); /* Changing length */ oTest.fnTest( "Changing table length to 25 records", function () { $("select[name=example_length]").val('25').change(); }, function () { return $('#example tbody tr').length == 25; } ); oTest.fnTest( "Changing table length to 50 records", function () { $("select[name=example_length]").val('50').change(); }, function () { return $('#example tbody tr').length == 50; } ); oTest.fnTest( "Changing table length to 100 records", function () { $("select[name=example_length]").val('100').change(); }, function () { return $('#example tbody tr').length == 57; } ); oTest.fnTest( "Changing table length to 10 records", function () { $("select[name=example_length]").val('10').change(); }, function () { return $('#example tbody tr').length == 10; } ); /* * Information element */ oTest.fnTest( "Information on zero config", null, function () { return document.getElementById('example_info').innerHTML == "Showing 1 to 10 of 57 entries"; } ); oTest.fnTest( "Information on second page", function () { $('#example_next').click(); }, function () { return document.getElementById('example_info').innerHTML == "Showing 11 to 20 of 57 entries"; } ); oTest.fnTest( "Information on third page", function () { $('#example_next').click(); }, function () { return document.getElementById('example_info').innerHTML == "Showing 21 to 30 of 57 entries"; } ); oTest.fnTest( "Information on last page", function () { $('#example_next').click(); $('#example_next').click(); $('#example_next').click(); }, function () { return document.getElementById('example_info').innerHTML == "Showing 51 to 57 of 57 entries"; } ); oTest.fnTest( "Information back on first page", function () { $('#example_previous').click(); $('#example_previous').click(); $('#example_previous').click(); $('#example_previous').click(); $('#example_previous').click(); }, function () { return document.getElementById('example_info').innerHTML == "Showing 1 to 10 of 57 entries"; } ); oTest.fnTest( "Information with 25 records", function () { $("select[name=example_length]").val('25').change(); }, function () { return document.getElementById('example_info').innerHTML == "Showing 1 to 25 of 57 entries"; } ); oTest.fnTest( "Information with 25 records - second page", function () { $('#example_next').click(); }, function () { return document.getElementById('example_info').innerHTML == "Showing 26 to 50 of 57 entries"; } ); oTest.fnTest( "Information with 100 records - first page", function () { $('#example_previous').click(); $("select[name=example_length]").val('100').change(); }, function () { return document.getElementById('example_info').innerHTML == "Showing 1 to 57 of 57 entries"; } ); oTest.fnTest( "Information back to 10 records", function () { $('#example_previous').click(); $("select[name=example_length]").val('10').change(); }, function () { return document.getElementById('example_info').innerHTML == "Showing 1 to 10 of 57 entries"; } ); oTest.fnTest( "Information with filter 'Win'", function () { $('#example_filter input').val("Win").keyup(); }, function () { return document.getElementById('example_info').innerHTML == "Showing 1 to 10 of 31 entries (filtered from 57 total entries)"; } ); oTest.fnTest( "Information with filter 'Win' second page", function () { $('#example_next').click(); }, function () { return document.getElementById('example_info').innerHTML == "Showing 11 to 20 of 31 entries (filtered from 57 total entries)"; } ); oTest.fnTest( "Information with filter 'Win' last page", function () { $('#example_next').click(); $('#example_next').click(); }, function () { return document.getElementById('example_info').innerHTML == "Showing 31 to 31 of 31 entries (filtered from 57 total entries)"; } ); oTest.fnTest( "Information with filter 'Win' back to first page", function () { $('#example_previous').click(); $('#example_previous').click(); $('#example_previous').click(); }, function () { return document.getElementById('example_info').innerHTML == "Showing 1 to 10 of 31 entries (filtered from 57 total entries)"; } ); oTest.fnTest( "Information with filter 'Win' second page - second time", function () { $('#example_next').click(); }, function () { return document.getElementById('example_info').innerHTML == "Showing 11 to 20 of 31 entries (filtered from 57 total entries)"; } ); oTest.fnTest( "Information with filter increased to 'Win 98'", function () { $('#example_filter input').val("Win 98").keyup(); }, function () { return document.getElementById('example_info').innerHTML == "Showing 1 to 9 of 9 entries (filtered from 57 total entries)"; } ); oTest.fnTest( "Information with filter decreased to 'Win'", function () { $('#example_filter input').val("Win").keyup(); }, function () { return document.getElementById('example_info').innerHTML == "Showing 1 to 10 of 31 entries (filtered from 57 total entries)"; } ); oTest.fnTest( "Information with filter 'Win' second page - third time", function () { $('#example_next').click(); }, function () { return document.getElementById('example_info').innerHTML == "Showing 11 to 20 of 31 entries (filtered from 57 total entries)"; } ); oTest.fnTest( "Information with filter removed", function () { $('#example_filter input').val("").keyup(); }, function () { return document.getElementById('example_info').innerHTML == "Showing 1 to 10 of 57 entries"; } ); /* * Filtering */ oTest.fnTest( "Filter 'W' - rows", function () { /* Reset the table such that the old sorting doesn't mess things up */ oSession.fnRestore(); $('#example').dataTable( oInit ); $('#example_filter input').val("W").keyup(); }, function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == "Gecko"; } ); oTest.fnTest( "Filter 'W' - info", null, function () { return document.getElementById('example_info').innerHTML == "Showing 1 to 10 of 42 entries (filtered from 57 total entries)"; } ); oTest.fnTest( "Filter 'Wi'", function () { $('#example_filter input').val("Wi").keyup(); }, function () { return document.getElementById('example_info').innerHTML == "Showing 1 to 10 of 32 entries (filtered from 57 total entries)"; } ); oTest.fnTest( "Filter 'Win'", function () { $('#example_filter input').val("Win").keyup(); }, function () { return document.getElementById('example_info').innerHTML == "Showing 1 to 10 of 31 entries (filtered from 57 total entries)"; } ); oTest.fnTest( "Filter 'Win' - sorting column 1", function () { $('#example thead th:eq(1)').click(); }, function () { return $('#example tbody tr:eq(0) td:eq(1)').html() == "AOL browser (AOL desktop)"; } ); oTest.fnTest( "Filter 'Win' - sorting column 1 info", null, function () { return document.getElementById('example_info').innerHTML == "Showing 1 to 10 of 31 entries (filtered from 57 total entries)"; } ); oTest.fnTest( "Filter 'Win' - sorting column 1 reverse", function () { $('#example thead th:eq(1)').click(); }, function () { return $('#example tbody tr:eq(0) td:eq(1)').html() == "Seamonkey 1.1"; } ); oTest.fnTest( "Filter 'Win XP' - maintaing reverse sorting col 1", function () { $('#example_filter input').val("Win XP").keyup(); }, function () { return $('#example tbody tr:eq(0) td:eq(1)').html() == "Internet Explorer 7"; } ); oTest.fnTest( "Filter 'Win XP' - sorting col 3", function () { $('#example thead th:eq(3)').click(); }, function () { return $('#example tbody tr:eq(0) td:eq(3)').html() == "4"; } ); oTest.fnTest( "Filter 'Win XP' - sorting col 3 - reversed", function () { $('#example thead th:eq(3)').click(); }, function () { return $('#example tbody tr:eq(0) td:eq(3)').html() == "7"; } ); oTest.fnTest( "Filter 'Win' - sorting col 3 - reversed info", null, function () { return document.getElementById('example_info').innerHTML == "Showing 1 to 6 of 6 entries (filtered from 57 total entries)"; } ); oTest.fnTest( "Filter 'nothinghere'", function () { $('#example_filter input').val("nothinghere").keyup(); }, function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == "No matching records found"; } ); oTest.fnTest( "Filter 'nothinghere' - info", null, function () { return document.getElementById('example_info').innerHTML == "Showing 0 to 0 of 0 entries (filtered from 57 total entries)"; } ); oTest.fnTest( "Filter back to blank and 1st column sorting", function () { $('#example_filter input').val("").keyup(); $('#example thead th:eq(0)').click(); }, function () { return document.getElementById('example_info').innerHTML == "Showing 1 to 10 of 57 entries"; } ); oTest.fnTest( "Prefixing a filter entry", function () { $('#example_filter input').val("Win").keyup(); $('#example_filter input').val("GeckoWin").keyup(); }, function () { return document.getElementById('example_info').innerHTML == "Showing 0 to 0 of 0 entries (filtered from 57 total entries)"; } ); oTest.fnTest( "Prefixing a filter entry with space", function () { $('#example_filter input').val("Gecko Win").keyup(); }, function () { return document.getElementById('example_info').innerHTML == "Showing 1 to 10 of 17 entries (filtered from 57 total entries)"; } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/2_js/aaSorting.js000066400000000000000000000112351265711500300233220ustar00rootroot00000000000000// DATA_TEMPLATE: js_data oTest.fnStart( "aaSorting" ); $(document).ready( function () { /* Check the default */ var oTable = $('#example').dataTable( { "aaData": gaaData } ); var oSettings = oTable.fnSettings(); oTest.fnTest( "Default sorting is single column", null, function () { return oSettings.aaSorting.length == 1 && typeof oSettings.aaSorting[0] == 'object'; } ); oTest.fnTest( "Default sorting is first column asc", null, function () { return oSettings.aaSorting[0].length == 3 && oSettings.aaSorting[0][0] == 0 && oSettings.aaSorting[0][1] == 'asc'; } ); oTest.fnTest( "Sorting is applied", null, function () { return $('#example tbody td:eq(0)').html() == "Gecko"; } ); oTest.fnTest( "Custom sorting on single string column asc", function () { oSession.fnRestore(); $('#example').dataTable( { "aaData": gaaData, "aaSorting": [['1','asc']] } ); }, function () { return $('#example tbody td:eq(1)').html() == "All others"; } ); oTest.fnTest( "Custom sorting on single string column desc", function () { oSession.fnRestore(); $('#example').dataTable( { "aaData": gaaData, "aaSorting": [['1','desc']] } ); }, function () { return $('#example tbody td:eq(1)').html() == "Seamonkey 1.1"; } ); oTest.fnTest( "Custom sorting on single int column asc", function () { oSession.fnRestore(); $('#example').dataTable( { "aaData": gaaData, "aaSorting": [['1','asc']] } ); }, function () { return $('#example tbody td:eq(3)').html() == "-"; } ); oTest.fnTest( "Custom sorting on single int column desc", function () { oSession.fnRestore(); $('#example').dataTable( { "aaData": gaaData, "aaSorting": [['1','desc']] } ); }, function () { return $('#example tbody td:eq(1)').html() == "Seamonkey 1.1"; } ); oTest.fnTest( "Multi-column sorting (2 column) - string asc / string asc", function () { oSession.fnRestore(); $('#example').dataTable( { "aaData": gaaData, "aaSorting": [['0','asc'], ['1','asc']] } ); }, function () { return $('#example tbody td:eq(1)').html() == "Camino 1.0"; } ); oTest.fnTest( "Multi-column sorting (2 column) - string asc / string desc", function () { oSession.fnRestore(); $('#example').dataTable( { "aaData": gaaData, "aaSorting": [['0','asc'], ['1','desc']] } ); }, function () { return $('#example tbody td:eq(1)').html() == "Seamonkey 1.1"; } ); oTest.fnTest( "Multi-column sorting (2 column) - string desc / string asc", function () { oSession.fnRestore(); $('#example').dataTable( { "aaData": gaaData, "aaSorting": [['0','desc'], ['1','asc']] } ); }, function () { return $('#example tbody td:eq(1)').html() == "iPod Touch / iPhone"; } ); oTest.fnTest( "Multi-column sorting (2 column) - string desc / string desc", function () { oSession.fnRestore(); $('#example').dataTable( { "aaData": gaaData, "aaSorting": [['0','desc'], ['1','desc']] } ); }, function () { return $('#example tbody td:eq(1)').html() == "Safari 3.0"; } ); oTest.fnTest( "Multi-column sorting (2 column) - string asc / int asc", function () { oSession.fnRestore(); $('#example').dataTable( { "aaData": gaaData, "aaSorting": [['0','asc'], ['3','asc']] } ); }, function () { return $('#example tbody td:eq(3)').html() == "1"; } ); oTest.fnTest( "Multi-column sorting (2 column) - string asc / int desc", function () { oSession.fnRestore(); $('#example').dataTable( { "aaData": gaaData, "aaSorting": [['0','asc'], ['3','desc']] } ); }, function () { return $('#example tbody td:eq(3)').html() == "1.9"; } ); oTest.fnTest( "Multi-column sorting (2 column) - string desc / int asc", function () { oSession.fnRestore(); $('#example').dataTable( { "aaData": gaaData, "aaSorting": [['0','desc'], ['3','asc']] } ); }, function () { return $('#example tbody td:eq(3)').html() == "125.5"; } ); oTest.fnTest( "Multi-column sorting (2 column) - string desc / int desc", function () { oSession.fnRestore(); $('#example').dataTable( { "aaData": gaaData, "aaSorting": [['0','desc'], ['3','desc']] } ); }, function () { return $('#example tbody td:eq(3)').html() == "522.1"; } ); oTest.fnTest( "Multi-column sorting (3 column) - string asc / int asc / string asc", function () { oSession.fnRestore(); $('#example').dataTable( { "aaData": gaaData, "aaSorting": [['0','asc'], ['3','asc'], ['1','asc']] } ); }, function () { return $('#example tbody tr:eq(7) td:eq(1)').html() == "Firefox 1.0"; } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/2_js/aaSortingFixed.js000066400000000000000000000031751265711500300243060ustar00rootroot00000000000000// DATA_TEMPLATE: js_data oTest.fnStart( "aaSortingFixed" ); $(document).ready( function () { /* Check the default */ var oTable = $('#example').dataTable( { "aaData": gaaData } ); var oSettings = oTable.fnSettings(); oTest.fnTest( "No fixed sorting by default", null, function () { return oSettings.aaSortingFixed == null; } ); oTest.fnTest( "Fixed sorting on first column (string/asc) with user sorting on second column (string/asc)", function () { oSession.fnRestore(); $('#example').dataTable( { "aaData": gaaData, "aaSortingFixed": [['0','asc']] } ); $('#example thead th:eq(1)').click(); }, function () { return $('#example tbody td:eq(1)').html() == "Camino 1.0"; } ); oTest.fnTest( "Fixed sorting on first column (string/asc) with user sorting on second column (string/desc)", function () { $('#example thead th:eq(1)').click(); }, function () { return $('#example tbody td:eq(1)').html() == "Seamonkey 1.1"; } ); oTest.fnTest( "Fixed sorting on fourth column (int/asc) with user sorting on second column (string/asc)", function () { oSession.fnRestore(); $('#example').dataTable( { "aaData": gaaData, "aaSortingFixed": [['3','asc']] } ); $('#example thead th:eq(1)').click(); }, function () { return $('#example tbody td:eq(1)').html() == "All others"; } ); oTest.fnTest( "Fixed sorting on fourth column (int/asc) with user sorting on second column (string/desc)", function () { $('#example thead th:eq(1)').click(); }, function () { return $('#example tbody td:eq(1)').html() == "PSP browser"; } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/2_js/aoColumns.bSearchable.js000077500000000000000000000034261265711500300255330ustar00rootroot00000000000000// DATA_TEMPLATE: js_data oTest.fnStart( "aoColumns.bSeachable" ); $(document).ready( function () { /* Check the default */ var oTable = $('#example').dataTable( { "aaData": gaaData } ); var oSettings = oTable.fnSettings(); oTest.fnTest( "Columns are searchable by default", function () { oTable.fnFilter("Camino"); }, function () { return $('#example tbody tr:eq(0) td:eq(1)').html().match(/Camino/); } ); oTest.fnTest( "Disabling sorting on a column removes it from the global filter", function () { oSession.fnRestore(); oTable = $('#example').dataTable( { "aaData": gaaData, "aoColumns": [ null, { "bSearchable": false }, null, null, null ] } ); oSettings = oTable.fnSettings(); oTable.fnFilter("Camino"); }, function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == "No matching records found"; } ); oTest.fnTest( "Disabled on one column has no effect on other columns", function () { oTable.fnFilter("Webkit"); }, function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == "Webkit"; } ); oTest.fnTest( "Disable filtering on multiple columns", function () { oSession.fnRestore(); oTable = $('#example').dataTable( { "aaData": gaaData, "aoColumns": [ { "bSearchable": false }, { "bSearchable": false }, null, null, null ] } ); oSettings = oTable.fnSettings(); oTable.fnFilter("Webkit"); }, function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == "No matching records found"; } ); oTest.fnTest( "Filter on second disabled column", function () { oTable.fnFilter("Camino"); }, function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == "No matching records found"; } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/2_js/aoColumns.bSortable.js000077500000000000000000000051471265711500300252570ustar00rootroot00000000000000// DATA_TEMPLATE: js_data oTest.fnStart( "aoColumns.bSortable" ); $(document).ready( function () { /* Check the default */ var oTable = $('#example').dataTable( { "aaData": gaaData } ); var oSettings = oTable.fnSettings(); oTest.fnTest( "All columns are sortable by default", function () { $('#example thead th:eq(1)').click(); }, function () { return $('#example tbody tr:eq(0) td:eq(1)').html() == "All others"; } ); oTest.fnTest( "Can disable sorting from one column", function () { oSession.fnRestore(); $('#example').dataTable( { "aaData": gaaData, "aoColumns": [ null, { "bSortable": false }, null, null, null ] } ); $('#example thead th:eq(1)').click(); }, function () { return $('#example tbody tr:eq(0) td:eq(1)').html() != "All others"; } ); oTest.fnTest( "Disabled column has no sorting class", null, function () { return $('#example thead th:eq(1)').hasClass("sorting_asc") == false; } ); oTest.fnTest( "Other columns can still sort", function () { $('#example thead th:eq(4)').click(); $('#example thead th:eq(4)').click(); }, function () { return $('#example tbody tr:eq(0) td:eq(4)').html() == "X"; } ); oTest.fnTest( "Disable sorting on multiple columns - no sorting classes", function () { oSession.fnRestore(); $('#example').dataTable( { "aaData": gaaData, "aoColumns": [ null, { "bSortable": false }, null, { "bSortable": false }, null ] } ); }, function () { var bReturn = $('#example thead th:eq(1)').hasClass("sorting") || $('#example thead th:eq(3)').hasClass("sorting") return bReturn == false; } ); oTest.fnTest( "Sorting on disabled column 1 has no effect", function () { $('#example thead th:eq(1)').click(); }, function () { return $('#example tbody tr:eq(0) td:eq(1)').html() != "All others"; } ); oTest.fnTest( "Sorting on disabled column 2 has no effect", function () { $('#example thead th:eq(3)').click(); }, function () { return $('#example tbody tr:eq(0) td:eq(3)').html() != "-"; } ); oTest.fnTest( "Second sort on disabled column 2 has no effect", function () { $('#example thead th:eq(3)').click(); }, function () { return $('#example tbody tr:eq(0) td:eq(3)').html() != "-"; } ); oTest.fnTest( "Even with multiple disabled sorting columns other columns can still sort", function () { $('#example thead th:eq(4)').click(); $('#example thead th:eq(4)').click(); }, function () { return $('#example tbody tr:eq(0) td:eq(4)').html() == "X"; } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/2_js/aoColumns.bUseRendered.js000077500000000000000000000064261265711500300257120ustar00rootroot00000000000000// DATA_TEMPLATE: js_data oTest.fnStart( "aoColumns.bUseRendered" ); /* bUseRendered is used to alter sorting data, if false then the original data is used for * sorting rather than the rendered data */ $(document).ready( function () { /* Check the default */ var mTmp = 0; var oTable = $('#example').dataTable( { "aaData": gaaData, "aoColumns": [ null, { "fnRender": function (a) { if ( mTmp == 0 ) { mTmp++; return "aaa"; } else return a.aData[a.iDataColumn]; } }, null, null, null ] } ); var oSettings = oTable.fnSettings(); oTest.fnTest( "Default for bUseRendered is true - rendered data is used for sorting", function () { $('#example thead th:eq(1)').click(); }, function () { return $('#example tbody tr:eq(0) td:eq(1)').html() == 'aaa'; } ); oTest.fnTest( "When bUseRendered is false, original data is used for sorting", function () { mTmp = 0; oSession.fnRestore(); oTable = $('#example').dataTable( { "aaData": gaaData, "aoColumns": [ null, { "bUseRendered": false, "fnRender": function (a) { if ( mTmp == 0 ) { mTmp++; return "aaa"; } else { return a.aData[a.iDataColumn]; } } }, null, null, null ] } ); $('#example thead th:eq(1)').click(); }, function () { return $('#example tbody tr:eq(0) td:eq(1)').html() == 'All others'; } ); oTest.fnTest( "bUseRendered set to false on one columns and true (default) on two others", function () { mTmp = 0; var mTmp2 = 0; var mTmp3 = 0; oSession.fnRestore(); oTable = $('#example').dataTable( { "aaData": gaaData, "aoColumns": [ { "fnRender": function (a) { if ( mTmp == 0 ) { mTmp++; return "aaa1"; } else { return a.aData[a.iDataColumn]; } } }, { "bUseRendered": false, "fnRender": function (a) { if ( mTmp2 == 0 ) { mTmp2++; return "aaa2"; } else { return a.aData[a.iDataColumn]; } } }, { "fnRender": function (a) { if ( mTmp3 == 0 ) { mTmp3++; return "zzz3"; } else { return a.aData[a.iDataColumn]; } } }, null, null ] } ); }, function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == 'aaa1'; } ); oTest.fnTest( "Multi-column rendering - 2nd column sorting", function () { $('#example thead th:eq(1)').click(); }, function () { return $('#example tbody tr:eq(0) td:eq(1)').html() == 'All others'; } ); oTest.fnTest( "Multi-column rendering - 3rd column sorting", function () { $('#example thead th:eq(2)').click(); $('#example thead th:eq(2)').click(); }, function () { return $('#example tbody tr:eq(0) td:eq(2)').html() == 'zzz3'; } ); oTest.fnTest( "Multi-column rendering - 4th column sorting", function () { $('#example thead th:eq(3)').click(); }, function () { return $('#example tbody tr:eq(0) td:eq(3)').html() == '-'; } ); oTest.fnTest( "Multi-column rendering - 5th column sorting", function () { $('#example thead th:eq(4)').click(); }, function () { return $('#example tbody tr:eq(0) td:eq(4)').html() == 'A'; } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/2_js/aoColumns.bVisible.js000077500000000000000000000050051265711500300250720ustar00rootroot00000000000000// DATA_TEMPLATE: js_data oTest.fnStart( "aoColumns.bVisible" ); $(document).ready( function () { /* Check the default */ var oTable = $('#example').dataTable( { "aaData": gaaData } ); var oSettings = oTable.fnSettings(); oTest.fnTest( "All columns are visible by default", null, function () { return $('#example tbody tr:eq(0) td').length == 5; } ); oTest.fnTest( "Can hide one column and it removes td column from DOM", function () { oSession.fnRestore(); $('#example').dataTable( { "aaData": gaaData, "aoColumns": [ null, { "bVisible": false }, null, null, null ] } ); }, function () { return $('#example tbody tr:eq(0) td').length == 4; } ); oTest.fnTest( "Can hide one column and it removes thead th column from DOM", null, function () { return $('#example thead tr:eq(0) th').length == 4; } ); oTest.fnTest( "Can hide one column and it removes tfoot th column from DOM", null, function () { return $('#example tfoot tr:eq(0) th').length == 4; } ); oTest.fnTest( "The correct tbody column has been hidden", function () { oDispacher.click( $('#example thead th:eq(1)')[0], { 'shift': true } ); }, function () { var jqNodes = $('#example tbody tr:eq(0) td'); var bReturn = jqNodes[0].innerHTML == "Gecko" && jqNodes[1].innerHTML == "Gnome" && jqNodes[2].innerHTML == "1.8" && jqNodes[3].innerHTML == "A"; return bReturn; } ); oTest.fnTest( "Can hide multiple columns and it removes td column from DOM", function () { oSession.fnRestore(); $('#example').dataTable( { "aaData": gaaData, "aoColumns": [ null, { "bVisible": false }, { "bVisible": false }, null, { "bVisible": false } ] } ); }, function () { return $('#example tbody tr:eq(0) td').length == 2; } ); oTest.fnTest( "Multiple hide - removes thead th column from DOM", null, function () { return $('#example thead tr:eq(0) th').length == 2; } ); oTest.fnTest( "Multiple hide - removes tfoot th column from DOM", null, function () { return $('#example tfoot tr:eq(0) th').length == 2; } ); oTest.fnTest( "Multiple hide - the correct tbody columns have been hidden", function () { oDispacher.click( $('#example thead th:eq(1)')[0], { 'shift': true } ); }, function () { var jqNodes = $('#example tbody tr:eq(0) td'); var bReturn = jqNodes[0].innerHTML == "Gecko" && jqNodes[1].innerHTML == "1" return bReturn; } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/2_js/aoColumns.fnRender.js000077500000000000000000000057371265711500300251120ustar00rootroot00000000000000// DATA_TEMPLATE: js_data oTest.fnStart( "aoColumns.fnRender" ); $(document).ready( function () { /* Check the default */ var mTmp = 0; var oTable = $('#example').dataTable( { "aaData": gaaData, "aoColumns": [ null, { "fnRender": function (a) { mTmp++; return a.aData[a.iDataColumn]; } }, null, null, null ] } ); var oSettings = oTable.fnSettings(); oTest.fnTest( "Single column - fnRender is called once for each row", null, function () { return mTmp == 57; } ); oTest.fnTest( "Confirm that fnRender passes two arguments with four parameters", function () { mTmp = true; oSession.fnRestore(); oTable = $('#example').dataTable( { "aaData": gaaData, "aoColumns": [ null, { "fnRender": function (a) { if ( arguments.length != 2 || typeof a.iDataRow=='undefined' || typeof a.iDataColumn=='undefined' || typeof a.aData=='undefined' || typeof a.mDataProp=='undefined' ) { mTmp = false; } return a.aData[a.iDataColumn]; } }, null, null, null ] } ); }, function () { return mTmp; } ); oTest.fnTest( "fnRender iDataColumn is the column", function () { mTmp = true; oSession.fnRestore(); oTable = $('#example').dataTable( { "aaData": gaaData, "aoColumns": [ null, { "fnRender": function (a) { if ( a.iDataColumn != 1 ) { mTmp = false; } return a.aData[a.iDataColumn]; } }, null, null, null ] } ); }, function () { return mTmp; } ); oTest.fnTest( "fnRender aData is data array of correct size", function () { mTmp = true; oSession.fnRestore(); oTable = $('#example').dataTable( { "aaData": gaaData, "aoColumns": [ null, { "fnRender": function (a) { if ( a.aData.length != 5 ) { mTmp = false; } return a.aData[a.iDataColumn]; } }, null, null, null ] } ); }, function () { return mTmp; } ); oTest.fnTest( "Passed back data is put into the DOM", function () { oSession.fnRestore(); oTable = $('#example').dataTable( { "aaData": gaaData, "aoColumns": [ null, { "fnRender": function (a) { return 'unittest'; } }, null, null, null ] } ); }, function () { return $('#example tbody tr:eq(0) td:eq(1)').html() == 'unittest'; } ); oTest.fnTest( "Passed back data is put into the DOM", function () { oSession.fnRestore(); oTable = $('#example').dataTable( { "aaData": gaaData, "aoColumns": [ null, null, { "fnRender": function (a) { return 'unittest1'; } }, { "fnRender": function (a) { return 'unittest2'; } }, null ] } ); }, function () { var bReturn = $('#example tbody tr:eq(0) td:eq(2)').html() == 'unittest1' && $('#example tbody tr:eq(0) td:eq(3)').html() == 'unittest2'; return bReturn; } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/2_js/aoColumns.iDataSort.js000077500000000000000000000046331265711500300252330ustar00rootroot00000000000000// DATA_TEMPLATE: js_data oTest.fnStart( "aoColumns.iDataSort" ); $(document).ready( function () { /* Should know that sorting already works by default from other tests, so we can jump * right in here */ var oTable = $('#example').dataTable( { "aaData": gaaData, "aoColumns": [ null, { "iDataSort": 4 }, null, null, null ] } ); var oSettings = oTable.fnSettings(); oTest.fnTest( "Sorting on first column is uneffected", null, function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == 'Gecko'; } ); oTest.fnTest( "Sorting on second column is the order of the fifth", function () { $('#example thead th:eq(1)').click(); }, function () { return $('#example tbody tr:eq(0) td:eq(4)').html() == 'A'; } ); oTest.fnTest( "Reserve sorting on second column uses fifth column as well", function () { $('#example thead th:eq(1)').click(); }, function () { return $('#example tbody tr:eq(0) td:eq(4)').html() == 'X'; } ); oTest.fnTest( "Sorting on 5th column retains it's own sorting", function () { $('#example thead th:eq(4)').click(); }, function () { return $('#example tbody tr:eq(0) td:eq(4)').html() == 'A'; } ); oTest.fnTest( "Use 2nd col for sorting 5th col and via-versa - no effect on first col sorting", function () { mTmp = 0; oSession.fnRestore(); oTable = $('#example').dataTable( { "aaData": gaaData, "aoColumns": [ null, { "iDataSort": 4 }, null, null, { "iDataSort": 1 } ] } ); }, function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == 'Gecko'; } ); oTest.fnTest( "2nd col sorting uses fifth col", function () { $('#example thead th:eq(1)').click(); }, function () { return $('#example tbody tr:eq(0) td:eq(4)').html() == 'A'; } ); oTest.fnTest( "2nd col sorting uses fifth col - reversed", function () { $('#example thead th:eq(1)').click(); }, function () { return $('#example tbody tr:eq(0) td:eq(4)').html() == 'X'; } ); oTest.fnTest( "5th col sorting uses 2nd col", function () { $('#example thead th:eq(4)').click(); }, function () { return $('#example tbody tr:eq(0) td:eq(1)').html() == 'All others'; } ); oTest.fnTest( "5th col sorting uses 2nd col - reversed", function () { $('#example thead th:eq(4)').click(); }, function () { return $('#example tbody tr:eq(0) td:eq(1)').html() == 'Seamonkey 1.1'; } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/2_js/aoColumns.sClass.js000077500000000000000000000057461265711500300245770ustar00rootroot00000000000000// DATA_TEMPLATE: js_data oTest.fnStart( "aoColumns.sClass" ); $(document).ready( function () { /* Check the default */ var oTable = $('#example').dataTable( { "aaData": gaaData } ); var oSettings = oTable.fnSettings(); oTest.fnTest( "By default the test class hasn't been applied to the column (sanity!)", null, function () { return $('#example tbody tr:eq(0) td:eq(2)').hasClass('unittest') == false; } ); oTest.fnTest( "Add a class to a single column - first row", function () { oSession.fnRestore(); $('#example').dataTable( { "aaData": gaaData, "aoColumns": [ null, null, { "sClass": 'unittest' }, null, null ] } ); }, function () { return $('#example tbody tr:eq(1) td:eq(2)').hasClass('unittest'); } ); oTest.fnTest( "Add a class to a single column - third row", null, function () { return $('#example tbody tr:eq(3) td:eq(2)').hasClass('unittest'); } ); oTest.fnTest( "Add a class to a single column - last row", null, function () { return $('#example tbody tr:eq(9) td:eq(2)').hasClass('unittest'); } ); oTest.fnTest( "Add a class to a single column - has not applied to other columns - 1st", null, function () { return $('#example tbody tr:eq(3) td:eq(0)').hasClass('unittest') == false; } ); oTest.fnTest( "Add a class to a single column - has not applied to other columns - 5th", null, function () { return $('#example tbody tr:eq(3) td:eq(4)').hasClass('unittest') == false; } ); oTest.fnTest( "Add a class to a single column - seventh row - second page", function () { $('#example_next').click(); }, function () { return $('#example tbody tr:eq(6) td:eq(2)').hasClass('unittest'); } ); oTest.fnTest( "Add a class to a single column - has not applied to header", null, function () { return $('#example thead tr:eq(3) th:eq(4)').hasClass('unittest') == false; } ); oTest.fnTest( "Add a class to a single column - has not applied to footer", null, function () { return $('#example thead tr:eq(3) th:eq(4)').hasClass('unittest') == false; } ); oTest.fnTest( "Class defined for multiple columns - first row", function () { oSession.fnRestore(); $('#example').dataTable( { "aaData": gaaData, "aoColumns": [ { "sClass": 'unittest2' }, null, null, { "sClass": 'unittest1' }, null ] } ); }, function () { var bReturn = $('#example tbody tr:eq(3) td:eq(0)').hasClass('unittest2') && $('#example tbody tr:eq(8) td:eq(3)').hasClass('unittest1'); return bReturn; } ); oTest.fnTest( "Class defined for multiple columns - has not applied to other columns - 5th 1", null, function () { return $('#example tbody tr:eq(0) td:eq(4)').hasClass('unittest1') == false; } ); oTest.fnTest( "Class defined for multiple columns - has not applied to other columns - 5th 2", null, function () { return $('#example tbody tr:eq(6) td:eq(4)').hasClass('unittest2') == false; } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/2_js/aoColumns.sName.js000077500000000000000000000011041265711500300243720ustar00rootroot00000000000000// DATA_TEMPLATE: js_data oTest.fnStart( "aoColumns.sName" ); /* This has no effect at all in DOM methods - so we just check that it has applied the name */ $(document).ready( function () { /* Check the default */ var oTable = $('#example').dataTable( { "aaData": gaaData, "aoColumns": [ null, null, null, { "sName": 'unit test' }, null ] } ); var oSettings = oTable.fnSettings(); oTest.fnTest( "Names are stored in the columns object", null, function () { return oSettings.aoColumns[3].sName =="unit test"; } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/2_js/aoColumns.sTitle.js000077500000000000000000000036101265711500300245770ustar00rootroot00000000000000// DATA_TEMPLATE: js_data oTest.fnStart( "aoColumns.sTitle" ); $(document).ready( function () { /* Check the default */ var oTable = $('#example').dataTable( { "aaData": gaaData } ); var oSettings = oTable.fnSettings(); oTest.fnTest( "If not given, then the columns titles are empty", null, function () { var jqNodes = $('#example thead tr:eq(0) th'); var bReturn = jqNodes[0].innerHTML == "Rendering engine" && jqNodes[1].innerHTML == "Browser" && jqNodes[2].innerHTML == "Platform(s)" && jqNodes[3].innerHTML == "Engine version" && jqNodes[4].innerHTML == "CSS grade"; return bReturn; } ); oTest.fnTest( "Can set a single column title - and others are read from DOM", function () { oSession.fnRestore(); $('#example').dataTable( { "aaData": gaaData, "aoColumns": [ null, { "sTitle": 'unit test' }, null, null, null ] } ); }, function () { var jqNodes = $('#example thead tr:eq(0) th'); var bReturn = jqNodes[0].innerHTML == "Rendering engine" && jqNodes[1].innerHTML == "unit test" && jqNodes[2].innerHTML == "Platform(s)" && jqNodes[3].innerHTML == "Engine version" && jqNodes[4].innerHTML == "CSS grade"; return bReturn; } ); oTest.fnTest( "Can set multiple column titles", function () { oSession.fnRestore(); $('#example').dataTable( { "aaData": gaaData, "aoColumns": [ null, { "sTitle": 'unit test 1' }, null, null, { "sTitle": 'unit test 2' } ] } ); }, function () { var jqNodes = $('#example thead tr:eq(0) th'); var bReturn = jqNodes[0].innerHTML == "Rendering engine" && jqNodes[1].innerHTML == "unit test 1" && jqNodes[2].innerHTML == "Platform(s)" && jqNodes[3].innerHTML == "Engine version" && jqNodes[4].innerHTML == "unit test 2"; return bReturn; } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/2_js/aoColumns.sWidth.js000077500000000000000000000036601265711500300246020ustar00rootroot00000000000000// DATA_TEMPLATE: js_data oTest.fnStart( "aoColumns.sWidth" ); /* NOTE - we need to disable the auto width for the majority of these test in order to preform * these tests as the auto width will convert the width to a px value. We can do 'non-exact' tests * with auto width enabled however to ensure it scales columns as required */ $(document).ready( function () { /* Check the default */ var oTable = $('#example').dataTable( { "aaData": gaaData, "bAutoWidth": false, "aoColumns": [ null, { "sWidth": '40%' }, null, null, null ] } ); var oSettings = oTable.fnSettings(); oTest.fnTest( "With auto width disabled the width for one column is appled", null, function () { return $('#example thead th:eq(1)')[0].style.width == "40%"; } ); oTest.fnTest( "With auto width disabled the width for one column is appled", function () { oSession.fnRestore(); oTable = $('#example').dataTable( { "aaData": gaaData, "bAutoWidth": false, "aoColumns": [ null, null, { "sWidth": '20%' }, { "sWidth": '30%' }, null ] } ); }, function () { var bReturn = $('#example thead th:eq(2)')[0].style.width == "20%" && $('#example thead th:eq(3)')[0].style.width == "30%"; return bReturn; } ); oTest.fnTest( "With auto width, it will make the smallest column the largest with percentage width given", function () { oSession.fnRestore(); oTable = $('#example').dataTable( { "aaData": gaaData, "aoColumns": [ null, null, null, { "sWidth": '40%' }, null ] } ); }, function () { var anThs = $('#example thead th'); var a0 = anThs[0].offsetWidth; var a1 = anThs[1].offsetWidth; var a2 = anThs[2].offsetWidth; var a3 = anThs[3].offsetWidth; var a4 = anThs[4].offsetWidth; if ( a3>a0 && a3>a1 && a3>a2 && a3>a4 ) return true; else return false; } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/2_js/aoSearchCols.js000066400000000000000000000060741265711500300237460ustar00rootroot00000000000000// DATA_TEMPLATE: js_data oTest.fnStart( "aoSearchCols" ); /* We could be here forever testing this one, so we test a limited subset on a couple of colums */ $(document).ready( function () { /* Check the default */ var oTable = $('#example').dataTable( { "aaData": gaaData } ); var oSettings = oTable.fnSettings(); oTest.fnTest( "Default should be to have a empty colums array", null, function () { var bReturn = oSettings.aoPreSearchCols[0].sSearch == 0 && !oSettings.aoPreSearchCols[0].bRegex && oSettings.aoPreSearchCols[1].sSearch == 0 && !oSettings.aoPreSearchCols[1].bRegex && oSettings.aoPreSearchCols[2].sSearch == 0 && !oSettings.aoPreSearchCols[2].bRegex && oSettings.aoPreSearchCols[3].sSearch == 0 && !oSettings.aoPreSearchCols[3].bRegex && oSettings.aoPreSearchCols[4].sSearch == 0 && !oSettings.aoPreSearchCols[4].bRegex; return bReturn; } ); oTest.fnTest( "Search on a single column - no regex statement given", function () { oSession.fnRestore(); oTable = $('#example').dataTable( { "aaData": gaaData, "aoSearchCols": [ null, { "sSearch": "Mozilla" }, null, { "sSearch": "1" }, null ] } ); }, function () { return $('#example_info').html() == "Showing 1 to 9 of 9 entries (filtered from 57 total entries)"; } ); oTest.fnTest( "Search on two columns - no regex statement given", function () { oSession.fnRestore(); oTable = $('#example').dataTable( { "aaData": gaaData, "aoSearchCols": [ null, { "sSearch": "Mozilla" }, null, { "sSearch": "1.5" }, null ] } ); }, function () { return $('#example tbody tr:eq(0) td:eq(3)').html() == "1.5"; } ); oTest.fnTest( "Search on single column - escape regex false", function () { oSession.fnRestore(); oTable = $('#example').dataTable( { "aaData": gaaData, "aoSearchCols": [ { "sSearch": ".*ML", "bEscapeRegex": false }, null, null, null, null ] } ); }, function () { return $('#example_info').html() == "Showing 1 to 3 of 3 entries (filtered from 57 total entries)"; } ); oTest.fnTest( "Search on two columns - escape regex false on first, true on second", function () { oSession.fnRestore(); oTable = $('#example').dataTable( { "aaData": gaaData, "aoSearchCols": [ { "sSearch": ".*ML", "bEscapeRegex": false }, { "sSearch": "3.3", "bEscapeRegex": true }, null, null, null ] } ); }, function () { return $('#example tbody tr:eq(0) td:eq(1)').html() == "Konqureror 3.3"; } ); oTest.fnTest( "Search on two columns (no records) - escape regex false on first, true on second", function () { oSession.fnRestore(); oTable = $('#example').dataTable( { "aaData": gaaData, "aoSearchCols": [ { "sSearch": ".*ML", "bEscapeRegex": false }, { "sSearch": "Allan", "bEscapeRegex": true }, null, null, null ] } ); }, function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == "No matching records found"; } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/2_js/asStripClasses.js000066400000000000000000000052171265711500300243410ustar00rootroot00000000000000// DATA_TEMPLATE: js_data oTest.fnStart( "asStripeClasses" ); $(document).ready( function () { /* Check the default */ $('#example').dataTable( { "aaData": gaaData } ); oTest.fnTest( "Default row striping is applied", null, function () { return $('#example tbody tr:eq(0)').hasClass('odd') && $('#example tbody tr:eq(1)').hasClass('even') && $('#example tbody tr:eq(2)').hasClass('odd') && $('#example tbody tr:eq(3)').hasClass('even'); } ); oTest.fnTest( "Row striping on the second page", function () { $('#example_next').click(); }, function () { return $('#example tbody tr:eq(0)').hasClass('odd') && $('#example tbody tr:eq(1)').hasClass('even') && $('#example tbody tr:eq(2)').hasClass('odd') && $('#example tbody tr:eq(3)').hasClass('even'); } ); /* No striping */ oTest.fnTest( "No row striping", function () { oSession.fnRestore(); $('#example').dataTable( { "aaData": gaaData, "asStripeClasses": [] } ); }, function () { return $('#example tbody tr:eq(0)')[0].className == "" && $('#example tbody tr:eq(1)')[0].className == "" && $('#example tbody tr:eq(2)')[0].className == "" && $('#example tbody tr:eq(3)')[0].className == ""; } ); /* Custom striping */ oTest.fnTest( "Custom striping [2]", function () { oSession.fnRestore(); $('#example').dataTable( { "aaData": gaaData, "asStripeClasses": [ 'test1', 'test2' ] } ); }, function () { return $('#example tbody tr:eq(0)').hasClass('test1') && $('#example tbody tr:eq(1)').hasClass('test2') && $('#example tbody tr:eq(2)').hasClass('test1') && $('#example tbody tr:eq(3)').hasClass('test2'); } ); /* long array of striping */ oTest.fnTest( "Custom striping [4]", function () { oSession.fnRestore(); $('#example').dataTable( { "aaData": gaaData, "asStripeClasses": [ 'test1', 'test2', 'test3', 'test4' ] } ); }, function () { return $('#example tbody tr:eq(0)').hasClass('test1') && $('#example tbody tr:eq(1)').hasClass('test2') && $('#example tbody tr:eq(2)').hasClass('test3') && $('#example tbody tr:eq(3)').hasClass('test4'); } ); oTest.fnTest( "Custom striping is restarted on second page [2]", function () { $('#example_next').click(); }, function () { return $('#example tbody tr:eq(0)').hasClass('test1') && $('#example tbody tr:eq(1)').hasClass('test2') && $('#example tbody tr:eq(2)').hasClass('test3') && $('#example tbody tr:eq(3)').hasClass('test4'); } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/2_js/bAutoWidth.js000066400000000000000000000072371265711500300234540ustar00rootroot00000000000000// DATA_TEMPLATE: js_data oTest.fnStart( "bAutoWidth" ); /* It's actually a little tricky to test this. We can't test absolute numbers because * different browsers and different platforms will render the width of the columns slightly * differently. However, we certainly can test the principle of what should happen (column * width doesn't change over pages) */ $(document).ready( function () { /* Check the default */ var oTable = $('#example').dataTable( { "aaData": gaaData } ); var oSettings = oTable.fnSettings(); oTest.fnTest( "Auto width is enabled by default", null, function () { return oSettings.oFeatures.bAutoWidth; } ); oTest.fnTest( "First column has a width assigned to it", null, function () { return $('#example thead th:eq(0)').attr('style').match(/width/i); } ); /* This would seem like a better test - but there appear to be difficulties with tables which are bigger (calculated) than there is actually room for. I suspect this is actually a bug in datatables oTest.fnTest( "Check column widths on first page match second page", null, function () { var anThs = $('#example thead th'); var a0 = anThs[0].offsetWidth; var a1 = anThs[1].offsetWidth; var a2 = anThs[2].offsetWidth; var a3 = anThs[3].offsetWidth; var a4 = anThs[4].offsetWidth; $('#example_next').click(); var b0 = anThs[0].offsetWidth; var b1 = anThs[1].offsetWidth; var b2 = anThs[2].offsetWidth; var b3 = anThs[3].offsetWidth; var b4 = anThs[4].offsetWidth; console.log( a0, b0, a1, b1, a2, b2, a3, b3 ); if ( a0==b0 && a1==b1 && a2==b2 && a3==b3 ) return true; else return false; } ); oTest.fnTest( "Check column widths on second page match thid page", null, function () { var anThs = $('#example thead th'); var a0 = anThs[0].offsetWidth; var a1 = anThs[1].offsetWidth; var a2 = anThs[2].offsetWidth; var a3 = anThs[3].offsetWidth; var a4 = anThs[4].offsetWidth; $('#example_next').click(); var b0 = anThs[0].offsetWidth; var b1 = anThs[1].offsetWidth; var b2 = anThs[2].offsetWidth; var b3 = anThs[3].offsetWidth; var b4 = anThs[4].offsetWidth; if ( a0==b0 && a1==b1 && a2==b2 && a3==b3 ) return true; else return false; } ); */ /* Check can disable */ oTest.fnTest( "Auto width can be disabled", function () { oSession.fnRestore(); oTable = $('#example').dataTable( { "aaData": gaaData, "bAutoWidth": false } ); oSettings = oTable.fnSettings(); }, function () { return oSettings.oFeatures.bAutoWidth == false; } ); oTest.fnTest( "First column does not have a width assigned to it", null, function () { return $('#example thead th:eq(0)').attr('style') == null; } ); /* oTest.fnTest( "Check column widths on first page do not match second page", null, function () { var anThs = $('#example thead th'); var a0 = anThs[0].offsetWidth; var a1 = anThs[1].offsetWidth; var a2 = anThs[2].offsetWidth; var a3 = anThs[3].offsetWidth; var a4 = anThs[4].offsetWidth; $('#example_next').click(); var b0 = anThs[0].offsetWidth; var b1 = anThs[1].offsetWidth; var b2 = anThs[2].offsetWidth; var b3 = anThs[3].offsetWidth; var b4 = anThs[4].offsetWidth; if ( a0==b0 && a1==b1 && a2==b2 && a3==b3 ) return false; else return true; } ); */ /* Enable makes no difference */ oTest.fnTest( "Auto width enabled override", function () { oSession.fnRestore(); oTable = $('#example').dataTable( { "aaData": gaaData, "bAutoWidth": true } ); oSettings = oTable.fnSettings(); }, function () { return oSettings.oFeatures.bAutoWidth; } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/2_js/bFilter.js000066400000000000000000000016171265711500300227650ustar00rootroot00000000000000// DATA_TEMPLATE: js_data oTest.fnStart( "bFilter" ); $(document).ready( function () { /* Check the default */ $('#example').dataTable( { "aaData": gaaData } ); oTest.fnTest( "Filtering div exists by default", null, function () { return document.getElementById('example_filter') != null; } ); /* Check can disable */ oTest.fnTest( "Fltering can be disabled", function () { oSession.fnRestore(); $('#example').dataTable( { "aaData": gaaData, "bFilter": false } ); }, function () { return document.getElementById('example_filter') == null; } ); /* Enable makes no difference */ oTest.fnTest( "Filtering enabled override", function () { oSession.fnRestore(); $('#example').dataTable( { "aaData": gaaData, "bFilter": true } ); }, function () { return document.getElementById('example_filter') != null; } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/2_js/bInfo.js000066400000000000000000000015651265711500300224350ustar00rootroot00000000000000// DATA_TEMPLATE: js_data oTest.fnStart( "bInfo" ); $(document).ready( function () { /* Check the default */ $('#example').dataTable( { "aaData": gaaData } ); oTest.fnTest( "Info div exists by default", null, function () { return document.getElementById('example_info') != null; } ); /* Check can disable */ oTest.fnTest( "Info can be disabled", function () { oSession.fnRestore(); $('#example').dataTable( { "aaData": gaaData, "bInfo": false } ); }, function () { return document.getElementById('example_info') == null; } ); /* Enable makes no difference */ oTest.fnTest( "Info enabled override", function () { oSession.fnRestore(); $('#example').dataTable( { "aaData": gaaData, "bInfo": true } ); }, function () { return document.getElementById('example_info') != null; } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/2_js/bLengthChange.js000066400000000000000000000033161265711500300240650ustar00rootroot00000000000000// DATA_TEMPLATE: js_data oTest.fnStart( "bLengthChange" ); $(document).ready( function () { /* Check the default */ $('#example').dataTable( { "aaData": gaaData } ); oTest.fnTest( "Length div exists by default", null, function () { return document.getElementById('example_length') != null; } ); oTest.fnTest( "Four default options", null, function () { return $("select[name=example_length] option").length == 4; } ); oTest.fnTest( "Default options", null, function () { var opts = $("select[name='example_length'] option"); return opts[0].getAttribute('value') == 10 && opts[1].getAttribute('value') == 25 && opts[2].getAttribute('value') == 50 && opts[3].getAttribute('value') == 100; } ); oTest.fnTest( "Info takes length into account", null, function () { return document.getElementById('example_info').innerHTML == "Showing 1 to 10 of 57 entries"; } ); /* Check can disable */ oTest.fnTest( "Change length can be disabled", function () { oSession.fnRestore(); $('#example').dataTable( { "aaData": gaaData, "bLengthChange": false } ); }, function () { return document.getElementById('example_length') == null; } ); oTest.fnTest( "Information takes length disabled into account", null, function () { return document.getElementById('example_info').innerHTML == "Showing 1 to 10 of 57 entries"; } ); /* Enable makes no difference */ oTest.fnTest( "Length change enabled override", function () { oSession.fnRestore(); $('#example').dataTable( { "aaData": gaaData, "bLengthChange": true } ); }, function () { return document.getElementById('example_length') != null; } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/2_js/bPaginate.js000066400000000000000000000024501265711500300232640ustar00rootroot00000000000000// DATA_TEMPLATE: js_data oTest.fnStart( "bPaginate" ); $(document).ready( function () { /* Check the default */ $('#example').dataTable( { "aaData": gaaData } ); oTest.fnTest( "Pagiantion div exists by default", null, function () { return document.getElementById('example_paginate') != null; } ); oTest.fnTest( "Information div takes paging into account", null, function () { return document.getElementById('example_info').innerHTML == "Showing 1 to 10 of 57 entries"; } ); /* Check can disable */ oTest.fnTest( "Pagiantion can be disabled", function () { oSession.fnRestore(); $('#example').dataTable( { "aaData": gaaData, "bPaginate": false } ); }, function () { return document.getElementById('example_paginate') == null; } ); oTest.fnTest( "Information div takes paging disabled into account", null, function () { return document.getElementById('example_info').innerHTML == "Showing 1 to 57 of 57 entries"; } ); /* Enable makes no difference */ oTest.fnTest( "Pagiantion enabled override", function () { oSession.fnRestore(); $('#example').dataTable( { "aaData": gaaData, "bPaginate": true } ); }, function () { return document.getElementById('example_paginate') != null; } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/2_js/bProcessing.js000066400000000000000000000060021265711500300236450ustar00rootroot00000000000000// DATA_TEMPLATE: js_data oTest.fnStart( "bProcessing" ); /* It's actually a bit hard to set this one due to the fact that it will only be shown * when DataTables is doing some kind of processing. The server-side processing is a bit * better to test this than here - so we just the interal functions to enable it and check * that it is available */ $(document).ready( function () { /* Check the default */ var oTable = $('#example').dataTable( { "aaData": gaaData } ); var oSettings = oTable.fnSettings(); oTest.fnTest( "Processing is off by default", null, function () { return oSettings.oFeatures.bProcessing == false; } ); oTest.fnTest( "Processing div is not in the DOM", function () { oTable.oApi._fnProcessingDisplay( oSettings, true ); }, function () { return document.getElementById('example_processing') == null; } ); oTest.fnTest( "Processing div cannot be shown", function () { oTable.oApi._fnProcessingDisplay( oSettings, true ); }, function () { return document.getElementById('example_processing') == null; } ); oTest.fnTest( "Processing div cannot be hidden", function () { oTable.oApi._fnProcessingDisplay( oSettings, false ); }, function () { return document.getElementById('example_processing') == null; } ); /* Check can disable */ oTest.fnTest( "Processing can be enabled", function () { oSession.fnRestore(); oTable = $('#example').dataTable( { "aaData": gaaData, "bProcessing": true } ); oSettings = oTable.fnSettings(); }, function () { return oSettings.oFeatures.bProcessing == true; } ); oTest.fnTest( "Processing div is in the DOM", function () { oTable.oApi._fnProcessingDisplay( oSettings, true ); }, function () { return document.getElementById('example_processing'); } ); oTest.fnTest( "Processing div is hidden by default", function () { oTable.oApi._fnProcessingDisplay( oSettings, true ); }, function () { return document.getElementById('example_processing').style.visibility = "hidden"; } ); oTest.fnTest( "Processing div can be shown", function () { oTable.oApi._fnProcessingDisplay( oSettings, true ); }, function () { return document.getElementById('example_processing').style.visibility = "visible"; } ); oTest.fnTest( "Processing div can be hidden", function () { oTable.oApi._fnProcessingDisplay( oSettings, false ); }, function () { return document.getElementById('example_processing').style.visibility = "hidden"; } ); /* Enable makes no difference */ oTest.fnTest( "Processing disabled override", function () { oSession.fnRestore(); oTable = $('#example').dataTable( { "aaData": gaaData, "bProcessing": false } ); oSettings = oTable.fnSettings(); }, function () { return oSettings.oFeatures.bProcessing == false; } ); oTest.fnTest( "Processing div is not in the DOM", function () { oTable.oApi._fnProcessingDisplay( oSettings, true ); }, function () { return document.getElementById('example_processing') == null; } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/2_js/bServerSide.js000066400000000000000000000007251265711500300236120ustar00rootroot00000000000000// DATA_TEMPLATE: js_data oTest.fnStart( "bServerSide" ); /* Not interested in server-side processing here other than to check that it is off */ $(document).ready( function () { /* Check the default */ var oTable = $('#example').dataTable( { "aaData": gaaData } ); var oSettings = oTable.fnSettings(); oTest.fnTest( "Server side is off by default", null, function () { return oSettings.oFeatures.bServerSide == false; } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/2_js/bSort.js000066400000000000000000000046041265711500300224660ustar00rootroot00000000000000// DATA_TEMPLATE: js_data oTest.fnStart( "bSort" ); $(document).ready( function () { /* Check the default */ $('#example').dataTable( { "aaData": gaaData } ); oTest.fnTest( "Sorting is on by default", null, function () { return $('#example tbody td:eq(0)').html() == "Gecko"; } ); oTest.fnTest( "Sorting Asc by default class applied", null, function () { return $('#example thead th:eq(0)').hasClass("sorting_asc"); } ); oTest.fnTest( "Click on second column", function () { $('#example thead th:eq(1)').click(); }, function () { return $('#example tbody td:eq(1)').html() == "All others"; } ); oTest.fnTest( "Sorting class removed from first column", null, function () { return $('#example thead th:eq(0)').hasClass("sorting_asc") != true; } ); oTest.fnTest( "Sorting asc class applied to second column", null, function () { return $('#example thead th:eq(1)').hasClass("sorting_asc"); } ); oTest.fnTest( "Reverse on second column", function () { $('#example thead th:eq(1)').click(); }, function () { return $('#example tbody td:eq(1)').html() == "Seamonkey 1.1"; } ); oTest.fnTest( "Sorting acs class removed from second column", null, function () { return $('#example thead th:eq(1)').hasClass("sorting_asc") != true; } ); oTest.fnTest( "Sorting desc class applied to second column", null, function () { return $('#example thead th:eq(1)').hasClass("sorting_desc"); } ); /* Check can disable */ oTest.fnTest( "Pagiantion can be disabled", function () { oSession.fnRestore(); $('#example').dataTable( { "aaData": gaaData, "bSort": false } ); }, function () { return $('#example tbody td:eq(3)').html() == "4"; } ); oTest.fnTest( "Click on second column has no effect", function () { $('#example thead th:eq(1)').click(); }, function () { return $('#example tbody td:eq(3)').html() == "4"; } ); oTest.fnTest( "Reverse on second column has no effect", function () { $('#example thead th:eq(1)').click(); }, function () { return $('#example tbody td:eq(3)').html() == "4"; } ); /* Enable makes no difference */ oTest.fnTest( "Sorting enabled override", function () { oSession.fnRestore(); $('#example').dataTable( { "aaData": gaaData, "bSort": true } ); }, function () { return $('#example tbody td:eq(0)').html() == "Gecko"; } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/2_js/bSortClasses.js000066400000000000000000000075161265711500300240110ustar00rootroot00000000000000// DATA_TEMPLATE: js_data oTest.fnStart( "bSortClasses" ); $(document).ready( function () { /* Check the default */ $('#example').dataTable( { "aaData": gaaData } ); oTest.fnTest( "Sorting classes are applied by default", null, function () { return $('#example tbody tr:eq(0) td:eq(0)').hasClass('sorting_1'); } ); oTest.fnTest( "Sorting classes are applied to all required cells", null, function () { return $('#example tbody tr:eq(7) td:eq(0)').hasClass('sorting_1'); } ); oTest.fnTest( "Sorting classes are not applied to non-sorting columns", null, function () { return $('#example tbody tr:eq(0) td:eq(1)').hasClass('sorting_1') == false; } ); oTest.fnTest( "Sorting multi-column - add column 1", function () { oDispacher.click( $('#example thead th:eq(1)')[0], { 'shift': true } ); }, function () { return $('#example tbody tr:eq(0) td:eq(0)').hasClass('sorting_1') && $('#example tbody tr:eq(0) td:eq(1)').hasClass('sorting_2'); } ); oTest.fnTest( "Sorting multi-column - add column 2", function () { oDispacher.click( $('#example thead th:eq(2)')[0], { 'shift': true } ); }, function () { return $('#example tbody tr:eq(0) td:eq(0)').hasClass('sorting_1') && $('#example tbody tr:eq(0) td:eq(1)').hasClass('sorting_2') && $('#example tbody tr:eq(0) td:eq(2)').hasClass('sorting_3'); } ); oTest.fnTest( "Sorting multi-column - add column 3", function () { oDispacher.click( $('#example thead th:eq(3)')[0], { 'shift': true } ); }, function () { return $('#example tbody tr:eq(0) td:eq(0)').hasClass('sorting_1') && $('#example tbody tr:eq(0) td:eq(1)').hasClass('sorting_2') && $('#example tbody tr:eq(0) td:eq(2)').hasClass('sorting_3') && $('#example tbody tr:eq(0) td:eq(3)').hasClass('sorting_3'); } ); oTest.fnTest( "Remove sorting classes on single column sort", function () { $('#example thead th:eq(4)').click(); }, function () { return $('#example tbody tr:eq(0) td:eq(0)').hasClass('sorting_1') == false && $('#example tbody tr:eq(0) td:eq(1)').hasClass('sorting_2') == false && $('#example tbody tr:eq(0) td:eq(2)').hasClass('sorting_3') == false && $('#example tbody tr:eq(0) td:eq(3)').hasClass('sorting_3') == false; } ); oTest.fnTest( "Sorting class 1 was added", null, function () { return $('#example tbody tr:eq(1) td:eq(4)').hasClass('sorting_1'); } ); /* Check can disable */ oTest.fnTest( "Sorting classes can be disabled", function () { oSession.fnRestore(); $('#example').dataTable( { "aaData": gaaData, "bSortClasses": false } ); }, function () { return $('#example tbody tr:eq(0) td:eq(0)').hasClass('sorting_1') == false; } ); oTest.fnTest( "Sorting classes disabled - add column 1 - no effect", function () { oDispacher.click( $('#example thead th:eq(1)')[0], { 'shift': true } ); }, function () { return $('#example tbody tr:eq(0) td:eq(0)').hasClass('sorting_1') == false && $('#example tbody tr:eq(0) td:eq(1)').hasClass('sorting_2') == false; } ); oTest.fnTest( "Sorting classes disabled - add column 2 - no effect", function () { oDispacher.click( $('#example thead th:eq(2)')[0], { 'shift': true } ); }, function () { return $('#example tbody tr:eq(0) td:eq(0)').hasClass('sorting_1') == false && $('#example tbody tr:eq(0) td:eq(1)').hasClass('sorting_2') == false && $('#example tbody tr:eq(0) td:eq(2)').hasClass('sorting_3') == false; } ); /* Enable makes no difference */ oTest.fnTest( "Sorting classes enabled override", function () { oSession.fnRestore(); $('#example').dataTable( { "aaData": gaaData, "bSortClasses": true } ); }, function () { return $('#example tbody tr:eq(0) td:eq(0)').hasClass('sorting_1'); } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/2_js/fnCreatedCell.js000077500000000000000000000056321265711500300240750ustar00rootroot00000000000000// DATA_TEMPLATE: js_data oTest.fnStart( "fnCreatedCell tests" ); $(document).ready( function () { var tmp = 0; $('#example').dataTable( { "aaData": gaaData, "aoColumnDefs": [ { fnCreatedCell: function () { tmp++; }, "aTargets": ["_all"] } ] } ); oTest.fnTest( "Cell created is called once for each cell on init", null, function () { return tmp===285; } ); oTest.fnTest( "Created isn't called back on other draws", function () { $('#example th:eq(1)').click(); }, function () { return tmp===285; } ); oTest.fnTest( "Four arguments for the function", function () { oSession.fnRestore(); tmp = true; $('#example').dataTable( { "aaData": gaaData, "aoColumnDefs": [ { fnCreatedRow: function () { if ( arguments.length !== 4 ) { tmp = false; } }, "aTargets": ["_all"] } ] } ); }, function () { return tmp; } ); oTest.fnTest( "First argument is a TD element", function () { oSession.fnRestore(); tmp = true; $('#example').dataTable( { "aaData": gaaData, "aoColumnDefs": [ { fnCreatedRow: function () { if ( arguments[0].nodeName !== "TD" ) { tmp = false; } }, "aTargets": ["_all"] } ] } ); }, function () { return tmp; } ); oTest.fnTest( "Second argument is the HTML value", function () { oSession.fnRestore(); tmp = true; $('#example').dataTable( { "aaData": gaaData, "aoColumnDefs": [ { fnCreatedRow: function () { if ( arguments[1] != $('td').html() ) { tmp = false; } }, "aTargets": ["_all"] } ] } ); }, function () { return tmp; } ); oTest.fnTest( "Third argument is the data array", function () { oSession.fnRestore(); tmp = true; $('#example').dataTable( { "aaData": gaaData, "aoColumnDefs": [ { fnCreatedRow: function () { if ( arguments[2].length !== 5 ) { tmp = false; } }, "aTargets": ["_all"] } ] } ); }, function () { return tmp; } ); oTest.fnTest( "Fourth argument is the data source for the row", function () { oSession.fnRestore(); tmp = true; $('#example').dataTable( { "aaData": gaaData, "aoColumnDefs": [ { fnCreatedRow: function () { if ( arguments[2] !== this.fnSettings().aoData[ arguments[2] ]._aData ) { tmp = false; } }, "aTargets": ["_all"] } ] } ); }, function () { return tmp; } ); oTest.fnTest( "Fifth argument is the the col index", function () { oSession.fnRestore(); tmp = true; $('#example').dataTable( { "aaData": gaaData, "aoColumnDefs": [ { fnCreatedRow: function () { if ( arguments[1] != $('td:eq('+arguments[4]+')', arguments[0].parentNode).html() ) { tmp = false; } }, "aTargets": ["_all"] } ] } ); }, function () { return tmp; } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/2_js/fnCreatedRow.js000077500000000000000000000042761265711500300237700ustar00rootroot00000000000000// DATA_TEMPLATE: js_data oTest.fnStart( "fnCreatedRow tests" ); $(document).ready( function () { var tmp = 0; $('#example').dataTable( { "aaData": gaaData, fnCreatedRow: function () { tmp++; } } ); oTest.fnTest( "Row created is called once for each row on init", null, function () { return tmp===57; } ); oTest.fnTest( "Created isn't called back on other draws", function () { $('#example th:eq(1)').click(); }, function () { return tmp===57; } ); oTest.fnTest( "Three arguments for the function", function () { oSession.fnRestore(); tmp = true; $('#example').dataTable( { "aaData": gaaData, fnCreatedRow: function () { if ( arguments.length !== 3 ) { tmp = false; } } } ); }, function () { return tmp; } ); oTest.fnTest( "First argument is a TR element", function () { oSession.fnRestore(); tmp = true; $('#example').dataTable( { "aaData": gaaData, fnCreatedRow: function () { if ( arguments[0].nodeName !== "TR" ) { tmp = false; } } } ); }, function () { return tmp; } ); oTest.fnTest( "Second argument is an array with 5 elements", function () { oSession.fnRestore(); tmp = true; $('#example').dataTable( { "aaData": gaaData, fnCreatedRow: function () { if ( arguments[1].length !== 5 ) { tmp = false; } } } ); }, function () { return tmp; } ); oTest.fnTest( "Third argument is the data source for the row", function () { oSession.fnRestore(); tmp = true; $('#example').dataTable( { "aaData": gaaData, fnCreatedRow: function () { if ( arguments[1] !== this.fnSettings().aoData[ arguments[2] ]._aData ) { tmp = false; } } } ); }, function () { return tmp; } ); oTest.fnTest( "TR element is tied to the correct data", function () { oSession.fnRestore(); tmp = false; $('#example').dataTable( { "aaData": gaaData, fnCreatedRow: function (tr, data, index) { if ( data[1] === "Firefox 1.0" ) { if ( $('td:eq(3)', tr).html() == "1.7" ) { tmp = true; } } } } ); }, function () { return tmp; } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/2_js/fnDrawCallback.js000066400000000000000000000030501265711500300242250ustar00rootroot00000000000000// DATA_TEMPLATE: js_data oTest.fnStart( "fnDrawCallback" ); /* Fairly boring function compared to the others! */ $(document).ready( function () { /* Check the default */ var oTable = $('#example').dataTable( { "aaData": gaaData } ); var oSettings = oTable.fnSettings(); var mPass; oTest.fnTest( "Default should be null", null, function () { return oSettings.fnDrawCallback == null; } ); oTest.fnTest( "One argument passed", function () { oSession.fnRestore(); mPass = -1; $('#example').dataTable( { "aaData": gaaData, "fnDrawCallback": function ( ) { mPass = arguments.length; } } ); }, function () { return mPass == 1; } ); oTest.fnTest( "That one argument is the settings object", function () { oSession.fnRestore(); oTable = $('#example').dataTable( { "aaData": gaaData, "fnDrawCallback": function ( oSettings ) { mPass = oSettings; } } ); }, function () { return oTable.fnSettings() == mPass; } ); oTest.fnTest( "fnRowCallback called once on first draw", function () { oSession.fnRestore(); mPass = 0; $('#example').dataTable( { "aaData": gaaData, "fnDrawCallback": function ( ) { mPass++; } } ); }, function () { return mPass == 1; } ); oTest.fnTest( "fnRowCallback called once on each draw there after as well", function () { $('#example_next').click(); $('#example_next').click(); $('#example_next').click(); }, function () { return mPass == 4; } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/2_js/fnFooterCallback.js000066400000000000000000000113021265711500300245650ustar00rootroot00000000000000// DATA_TEMPLATE: js_data oTest.fnStart( "fnFooterCallback" ); $(document).ready( function () { /* Check the default */ var oTable = $('#example').dataTable( { "aaData": gaaData } ); var oSettings = oTable.fnSettings(); var mPass; oTest.fnTest( "Default should be null", null, function () { return oSettings.fnFooterCallback == null; } ); oTest.fnTest( "Five arguments passed", function () { oSession.fnRestore(); mPass = -1; $('#example').dataTable( { "aaData": gaaData, "fnFooterCallback": function ( ) { mPass = arguments.length; } } ); }, function () { return mPass == 5; } ); oTest.fnTest( "fnRowCallback called once per draw", function () { oSession.fnRestore(); mPass = 0; $('#example').dataTable( { "aaData": gaaData, "fnFooterCallback": function ( nFoot, aasData, iStart, iEnd, aiDisplay ) { mPass++; } } ); }, function () { return mPass == 1; } ); oTest.fnTest( "fnRowCallback called on paging (i.e. another draw)", function () { $('#example_next').click(); }, function () { return mPass == 2; } ); oTest.fnTest( "fnRowCallback allows us to alter row information", function () { oSession.fnRestore(); $('#example').dataTable( { "aaData": gaaData, "fnFooterCallback": function ( nFoot, aasData, iStart, iEnd, aiDisplay ) { nFoot.getElementsByTagName('th')[0].innerHTML = "Displaying "+(iEnd-iStart)+" records"; } } ); }, function () { return $('#example tfoot th:eq(0)').html() == "Displaying 10 records"; } ); oTest.fnTest( "Data array has length matching original data", function () { oSession.fnRestore(); mPass = true; $('#example').dataTable( { "aaData": gaaData, "fnFooterCallback": function ( nFoot, aasData, iStart, iEnd, aiDisplay ) { if ( aasData.length != 57 ) { mPass = false; } } } ); }, function () { return mPass; } ); oTest.fnTest( "Data array's column lengths match original data", function () { oSession.fnRestore(); mPass = true; $('#example').dataTable( { "aaData": gaaData, "fnFooterCallback": function ( nFoot, aasData, iStart, iEnd, aiDisplay ) { for ( var i=0, iLen=aasData.length ; i' } ); oSettings = oTable.fnSettings(); }, function () { return oSettings.sDom == '<"wrapper"flipt>'; } ); oTest.fnTest( "Check example 1 in DOM", null, function () { var jqNodes = $('#demo div, #demo table'); var nNodes = []; /* Strip the paging nodes */ for ( var i=0, iLen=jqNodes.length ; iip>' } ); }, function () { var jqNodes = $('#demo div, #demo table'); var nNodes = []; var nCustomWrappers = [] /* Strip the paging nodes */ for ( var i=0, iLen=jqNodes.length ; ia0 && a3>a1 && a3>a2 && a3>a4 ) return true; else return false; } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/3_ajax/aoSearchCols.js000066400000000000000000000065161265711500300242570ustar00rootroot00000000000000// DATA_TEMPLATE: empty_table oTest.fnStart( "aoSearchCols" ); /* We could be here forever testing this one, so we test a limited subset on a couple of colums */ $(document).ready( function () { /* Check the default */ var oTable = $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt" } ); var oSettings = oTable.fnSettings(); oTest.fnWaitTest( "Default should be to have a empty colums array", null, function () { var bReturn = oSettings.aoPreSearchCols[0].sSearch == 0 && !oSettings.aoPreSearchCols[0].bRegex && oSettings.aoPreSearchCols[1].sSearch == 0 && !oSettings.aoPreSearchCols[1].bRegex && oSettings.aoPreSearchCols[2].sSearch == 0 && !oSettings.aoPreSearchCols[2].bRegex && oSettings.aoPreSearchCols[3].sSearch == 0 && !oSettings.aoPreSearchCols[3].bRegex && oSettings.aoPreSearchCols[4].sSearch == 0 && !oSettings.aoPreSearchCols[4].bRegex; return bReturn; } ); oTest.fnWaitTest( "Search on a single column - no regex statement given", function () { oSession.fnRestore(); oTable = $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt", "aoSearchCols": [ null, { "sSearch": "Mozilla" }, null, { "sSearch": "1" }, null ] } ); }, function () { return $('#example_info').html() == "Showing 1 to 9 of 9 entries (filtered from 57 total entries)"; } ); oTest.fnWaitTest( "Search on two columns - no regex statement given", function () { oSession.fnRestore(); oTable = $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt", "aoSearchCols": [ null, { "sSearch": "Mozilla" }, null, { "sSearch": "1.5" }, null ] } ); }, function () { return $('#example tbody tr:eq(0) td:eq(3)').html() == "1.5"; } ); oTest.fnWaitTest( "Search on single column - escape regex false", function () { oSession.fnRestore(); oTable = $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt", "aoSearchCols": [ { "sSearch": ".*ML", "bEscapeRegex": false }, null, null, null, null ] } ); }, function () { return $('#example_info').html() == "Showing 1 to 3 of 3 entries (filtered from 57 total entries)"; } ); oTest.fnWaitTest( "Search on two columns - escape regex false on first, true on second", function () { oSession.fnRestore(); oTable = $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt", "aoSearchCols": [ { "sSearch": ".*ML", "bEscapeRegex": false }, { "sSearch": "3.3", "bEscapeRegex": true }, null, null, null ] } ); }, function () { return $('#example tbody tr:eq(0) td:eq(1)').html() == "Konqureror 3.3"; } ); oTest.fnWaitTest( "Search on two columns (no records) - escape regex false on first, true on second", function () { oSession.fnRestore(); oTable = $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt", "aoSearchCols": [ { "sSearch": ".*ML", "bEscapeRegex": false }, { "sSearch": "Allan", "bEscapeRegex": true }, null, null, null ] } ); }, function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == "No matching records found"; } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/3_ajax/asStripClasses.js000066400000000000000000000057451265711500300246570ustar00rootroot00000000000000// DATA_TEMPLATE: empty_table oTest.fnStart( "asStripeClasses" ); $(document).ready( function () { /* Check the default */ $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt" } ); oTest.fnWaitTest( "Default row striping is applied", null, function () { return $('#example tbody tr:eq(0)').hasClass('odd') && $('#example tbody tr:eq(1)').hasClass('even') && $('#example tbody tr:eq(2)').hasClass('odd') && $('#example tbody tr:eq(3)').hasClass('even'); } ); oTest.fnWaitTest( "Row striping on the second page", function () { $('#example_next').click(); }, function () { return $('#example tbody tr:eq(0)').hasClass('odd') && $('#example tbody tr:eq(1)').hasClass('even') && $('#example tbody tr:eq(2)').hasClass('odd') && $('#example tbody tr:eq(3)').hasClass('even'); } ); /* No striping */ oTest.fnWaitTest( "No row striping", function () { oSession.fnRestore(); $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt", "asStripeClasses": [] } ); }, function () { if ( typeof $('#example tbody tr:eq(1)')[0] == 'undefined' ) { /* Use the 'wait for' to allow this to become true */ return false; } return $('#example tbody tr:eq(0)')[0].className == "" && $('#example tbody tr:eq(1)')[0].className == "" && $('#example tbody tr:eq(2)')[0].className == "" && $('#example tbody tr:eq(3)')[0].className == ""; } ); /* Custom striping */ oTest.fnWaitTest( "Custom striping [2]", function () { oSession.fnRestore(); $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt", "asStripeClasses": [ 'test1', 'test2' ] } ); }, function () { return $('#example tbody tr:eq(0)').hasClass('test1') && $('#example tbody tr:eq(1)').hasClass('test2') && $('#example tbody tr:eq(2)').hasClass('test1') && $('#example tbody tr:eq(3)').hasClass('test2'); } ); /* long array of striping */ oTest.fnWaitTest( "Custom striping [4]", function () { oSession.fnRestore(); $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt", "asStripeClasses": [ 'test1', 'test2', 'test3', 'test4' ] } ); }, function () { return $('#example tbody tr:eq(0)').hasClass('test1') && $('#example tbody tr:eq(1)').hasClass('test2') && $('#example tbody tr:eq(2)').hasClass('test3') && $('#example tbody tr:eq(3)').hasClass('test4'); } ); oTest.fnWaitTest( "Custom striping is restarted on second page [2]", function () { $('#example_next').click(); }, function () { return $('#example tbody tr:eq(0)').hasClass('test1') && $('#example tbody tr:eq(1)').hasClass('test2') && $('#example tbody tr:eq(2)').hasClass('test3') && $('#example tbody tr:eq(3)').hasClass('test4'); } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/3_ajax/bAutoWidth.js000066400000000000000000000074761265711500300237710ustar00rootroot00000000000000// DATA_TEMPLATE: empty_table oTest.fnStart( "bAutoWidth" ); /* It's actually a little tricky to test this. We can't test absolute numbers because * different browsers and different platforms will render the width of the columns slightly * differently. However, we certainly can test the principle of what should happen (column * width doesn't change over pages) */ $(document).ready( function () { /* Check the default */ var oTable = $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt" } ); var oSettings = oTable.fnSettings(); oTest.fnWaitTest( "Auto width is enabled by default", null, function () { return oSettings.oFeatures.bAutoWidth; } ); oTest.fnWaitTest( "First column has a width assigned to it", null, function () { return $('#example thead th:eq(0)').attr('style').match(/width/i); } ); /* This would seem like a better test - but there appear to be difficulties with tables which are bigger (calculated) than there is actually room for. I suspect this is actually a bug in datatables oTest.fnWaitTest( "Check column widths on first page match second page", null, function () { var anThs = $('#example thead th'); var a0 = anThs[0].offsetWidth; var a1 = anThs[1].offsetWidth; var a2 = anThs[2].offsetWidth; var a3 = anThs[3].offsetWidth; var a4 = anThs[4].offsetWidth; $('#example_next').click(); var b0 = anThs[0].offsetWidth; var b1 = anThs[1].offsetWidth; var b2 = anThs[2].offsetWidth; var b3 = anThs[3].offsetWidth; var b4 = anThs[4].offsetWidth; console.log( a0, b0, a1, b1, a2, b2, a3, b3 ); if ( a0==b0 && a1==b1 && a2==b2 && a3==b3 ) return true; else return false; } ); oTest.fnWaitTest( "Check column widths on second page match thid page", null, function () { var anThs = $('#example thead th'); var a0 = anThs[0].offsetWidth; var a1 = anThs[1].offsetWidth; var a2 = anThs[2].offsetWidth; var a3 = anThs[3].offsetWidth; var a4 = anThs[4].offsetWidth; $('#example_next').click(); var b0 = anThs[0].offsetWidth; var b1 = anThs[1].offsetWidth; var b2 = anThs[2].offsetWidth; var b3 = anThs[3].offsetWidth; var b4 = anThs[4].offsetWidth; if ( a0==b0 && a1==b1 && a2==b2 && a3==b3 ) return true; else return false; } ); */ /* Check can disable */ oTest.fnWaitTest( "Auto width can be disabled", function () { oSession.fnRestore(); oTable = $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt", "bAutoWidth": false } ); oSettings = oTable.fnSettings(); }, function () { return oSettings.oFeatures.bAutoWidth == false; } ); oTest.fnWaitTest( "First column does not have a width assigned to it", null, function () { return $('#example thead th:eq(0)').attr('style') == null; } ); /* oTest.fnWaitTest( "Check column widths on first page do not match second page", null, function () { var anThs = $('#example thead th'); var a0 = anThs[0].offsetWidth; var a1 = anThs[1].offsetWidth; var a2 = anThs[2].offsetWidth; var a3 = anThs[3].offsetWidth; var a4 = anThs[4].offsetWidth; $('#example_next').click(); var b0 = anThs[0].offsetWidth; var b1 = anThs[1].offsetWidth; var b2 = anThs[2].offsetWidth; var b3 = anThs[3].offsetWidth; var b4 = anThs[4].offsetWidth; if ( a0==b0 && a1==b1 && a2==b2 && a3==b3 ) return false; else return true; } ); */ /* Enable makes no difference */ oTest.fnWaitTest( "Auto width enabled override", function () { oSession.fnRestore(); oTable = $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt", "bAutoWidth": true } ); oSettings = oTable.fnSettings(); }, function () { return oSettings.oFeatures.bAutoWidth; } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/3_ajax/bFilter.js000066400000000000000000000020321265711500300232650ustar00rootroot00000000000000// DATA_TEMPLATE: empty_table oTest.fnStart( "bFilter" ); $(document).ready( function () { /* Check the default */ $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt" } ); oTest.fnWaitTest( "Filtering div exists by default", null, function () { return document.getElementById('example_filter') != null; } ); /* Check can disable */ oTest.fnWaitTest( "Fltering can be disabled", function () { oSession.fnRestore(); $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt", "bFilter": false } ); }, function () { return document.getElementById('example_filter') == null; } ); /* Enable makes no difference */ oTest.fnWaitTest( "Filtering enabled override", function () { oSession.fnRestore(); $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt", "bFilter": true } ); }, function () { return document.getElementById('example_filter') != null; } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/3_ajax/bInfo.js000066400000000000000000000020001265711500300227260ustar00rootroot00000000000000// DATA_TEMPLATE: empty_table oTest.fnStart( "bInfo" ); $(document).ready( function () { /* Check the default */ $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt" } ); oTest.fnWaitTest( "Info div exists by default", null, function () { return document.getElementById('example_info') != null; } ); /* Check can disable */ oTest.fnWaitTest( "Info can be disabled", function () { oSession.fnRestore(); $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt", "bInfo": false } ); }, function () { return document.getElementById('example_info') == null; } ); /* Enable makes no difference */ oTest.fnWaitTest( "Info enabled override", function () { oSession.fnRestore(); $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt", "bInfo": true } ); }, function () { return document.getElementById('example_info') != null; } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/3_ajax/bLengthChange.js000066400000000000000000000035511265711500300243760ustar00rootroot00000000000000// DATA_TEMPLATE: empty_table oTest.fnStart( "bLengthChange" ); $(document).ready( function () { /* Check the default */ $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt" } ); oTest.fnWaitTest( "Length div exists by default", null, function () { return document.getElementById('example_length') != null; } ); oTest.fnWaitTest( "Four default options", null, function () { return $("select[name=example_length] option").length == 4; } ); oTest.fnWaitTest( "Default options", null, function () { var opts = $("select[name='example_length'] option"); return opts[0].getAttribute('value') == 10 && opts[1].getAttribute('value') == 25 && opts[2].getAttribute('value') == 50 && opts[3].getAttribute('value') == 100; } ); oTest.fnWaitTest( "Info takes length into account", null, function () { return document.getElementById('example_info').innerHTML == "Showing 1 to 10 of 57 entries"; } ); /* Check can disable */ oTest.fnWaitTest( "Change length can be disabled", function () { oSession.fnRestore(); $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt", "bLengthChange": false } ); }, function () { return document.getElementById('example_length') == null; } ); oTest.fnWaitTest( "Information takes length disabled into account", null, function () { return document.getElementById('example_info').innerHTML == "Showing 1 to 10 of 57 entries"; } ); /* Enable makes no difference */ oTest.fnWaitTest( "Length change enabled override", function () { oSession.fnRestore(); $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt", "bLengthChange": true } ); }, function () { return document.getElementById('example_length') != null; } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/3_ajax/bPaginate.js000066400000000000000000000026731265711500300236030ustar00rootroot00000000000000// DATA_TEMPLATE: empty_table oTest.fnStart( "bPaginate" ); $(document).ready( function () { /* Check the default */ $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt" } ); oTest.fnWaitTest( "Pagiantion div exists by default", null, function () { return document.getElementById('example_paginate') != null; } ); oTest.fnWaitTest( "Information div takes paging into account", null, function () { return document.getElementById('example_info').innerHTML == "Showing 1 to 10 of 57 entries"; } ); /* Check can disable */ oTest.fnWaitTest( "Pagiantion can be disabled", function () { oSession.fnRestore(); $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt", "bPaginate": false } ); }, function () { return document.getElementById('example_paginate') == null; } ); oTest.fnWaitTest( "Information div takes paging disabled into account", null, function () { return document.getElementById('example_info').innerHTML == "Showing 1 to 57 of 57 entries"; } ); /* Enable makes no difference */ oTest.fnWaitTest( "Pagiantion enabled override", function () { oSession.fnRestore(); $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt", "bPaginate": true } ); }, function () { return document.getElementById('example_paginate') != null; } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/3_ajax/bProcessing.js000066400000000000000000000062551265711500300241670ustar00rootroot00000000000000// DATA_TEMPLATE: empty_table oTest.fnStart( "bProcessing" ); /* It's actually a bit hard to set this one due to the fact that it will only be shown * when DataTables is doing some kind of processing. The server-side processing is a bit * better to test this than here - so we just the interal functions to enable it and check * that it is available */ $(document).ready( function () { /* Check the default */ var oTable = $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt" } ); var oSettings = oTable.fnSettings(); oTest.fnWaitTest( "Processing is off by default", null, function () { return oSettings.oFeatures.bProcessing == false; } ); oTest.fnWaitTest( "Processing div is not in the DOM", function () { oTable.oApi._fnProcessingDisplay( oSettings, true ); }, function () { return document.getElementById('example_processing') == null; } ); oTest.fnWaitTest( "Processing div cannot be shown", function () { oTable.oApi._fnProcessingDisplay( oSettings, true ); }, function () { return document.getElementById('example_processing') == null; } ); oTest.fnWaitTest( "Processing div cannot be hidden", function () { oTable.oApi._fnProcessingDisplay( oSettings, false ); }, function () { return document.getElementById('example_processing') == null; } ); /* Check can disable */ oTest.fnWaitTest( "Processing can be enabled", function () { oSession.fnRestore(); oTable = $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt", "bProcessing": true } ); oSettings = oTable.fnSettings(); }, function () { return oSettings.oFeatures.bProcessing == true; } ); oTest.fnWaitTest( "Processing div is in the DOM", function () { oTable.oApi._fnProcessingDisplay( oSettings, true ); }, function () { return document.getElementById('example_processing'); } ); oTest.fnWaitTest( "Processing div is hidden by default", function () { oTable.oApi._fnProcessingDisplay( oSettings, true ); }, function () { return document.getElementById('example_processing').style.visibility = "hidden"; } ); oTest.fnWaitTest( "Processing div can be shown", function () { oTable.oApi._fnProcessingDisplay( oSettings, true ); }, function () { return document.getElementById('example_processing').style.visibility = "visible"; } ); oTest.fnWaitTest( "Processing div can be hidden", function () { oTable.oApi._fnProcessingDisplay( oSettings, false ); }, function () { return document.getElementById('example_processing').style.visibility = "hidden"; } ); /* Enable makes no difference */ oTest.fnWaitTest( "Processing disabled override", function () { oSession.fnRestore(); oTable = $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt", "bProcessing": false } ); oSettings = oTable.fnSettings(); }, function () { return oSettings.oFeatures.bProcessing == false; } ); oTest.fnWaitTest( "Processing div is not in the DOM", function () { oTable.oApi._fnProcessingDisplay( oSettings, true ); }, function () { return document.getElementById('example_processing') == null; } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/3_ajax/bServerSide.js000066400000000000000000000010061265711500300241130ustar00rootroot00000000000000// DATA_TEMPLATE: empty_table oTest.fnStart( "bServerSide" ); /* Not interested in server-side processing here other than to check that it is off */ $(document).ready( function () { /* Check the default */ var oTable = $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt" } ); var oSettings = oTable.fnSettings(); oTest.fnWaitTest( "Server side is off by default", null, function () { return oSettings.oFeatures.bServerSide == false; } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/3_ajax/bSort.js000066400000000000000000000050631265711500300227760ustar00rootroot00000000000000// DATA_TEMPLATE: empty_table oTest.fnStart( "bSort" ); $(document).ready( function () { /* Check the default */ $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt" } ); oTest.fnWaitTest( "Sorting is on by default", null, function () { return $('#example tbody td:eq(0)').html() == "Gecko"; } ); oTest.fnWaitTest( "Sorting Asc by default class applied", null, function () { return $('#example thead th:eq(0)').hasClass("sorting_asc"); } ); oTest.fnWaitTest( "Click on second column", function () { $('#example thead th:eq(1)').click(); }, function () { return $('#example tbody td:eq(1)').html() == "All others"; } ); oTest.fnWaitTest( "Sorting class removed from first column", null, function () { return $('#example thead th:eq(0)').hasClass("sorting_asc") != true; } ); oTest.fnWaitTest( "Sorting asc class applied to second column", null, function () { return $('#example thead th:eq(1)').hasClass("sorting_asc"); } ); oTest.fnWaitTest( "Reverse on second column", function () { $('#example thead th:eq(1)').click(); }, function () { return $('#example tbody td:eq(1)').html() == "Seamonkey 1.1"; } ); oTest.fnWaitTest( "Sorting acs class removed from second column", null, function () { return $('#example thead th:eq(1)').hasClass("sorting_asc") != true; } ); oTest.fnWaitTest( "Sorting desc class applied to second column", null, function () { return $('#example thead th:eq(1)').hasClass("sorting_desc"); } ); /* Check can disable */ oTest.fnWaitTest( "Pagiantion can be disabled", function () { oSession.fnRestore(); $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt", "bSort": false } ); }, function () { return $('#example tbody td:eq(3)').html() == "4"; } ); oTest.fnWaitTest( "Click on second column has no effect", function () { $('#example thead th:eq(1)').click(); }, function () { return $('#example tbody td:eq(3)').html() == "4"; } ); oTest.fnWaitTest( "Reverse on second column has no effect", function () { $('#example thead th:eq(1)').click(); }, function () { return $('#example tbody td:eq(3)').html() == "4"; } ); /* Enable makes no difference */ oTest.fnWaitTest( "Sorting enabled override", function () { oSession.fnRestore(); $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt", "bSort": true } ); }, function () { return $('#example tbody td:eq(0)').html() == "Gecko"; } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/3_ajax/bSortClasses.js000066400000000000000000000077751265711500300243300ustar00rootroot00000000000000// DATA_TEMPLATE: empty_table oTest.fnStart( "bSortClasses" ); $(document).ready( function () { /* Check the default */ $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt" } ); oTest.fnWaitTest( "Sorting classes are applied by default", null, function () { return $('#example tbody tr:eq(0) td:eq(0)').hasClass('sorting_1'); } ); oTest.fnWaitTest( "Sorting classes are applied to all required cells", null, function () { return $('#example tbody tr:eq(7) td:eq(0)').hasClass('sorting_1'); } ); oTest.fnWaitTest( "Sorting classes are not applied to non-sorting columns", null, function () { return $('#example tbody tr:eq(0) td:eq(1)').hasClass('sorting_1') == false; } ); oTest.fnWaitTest( "Sorting multi-column - add column 1", function () { oDispacher.click( $('#example thead th:eq(1)')[0], { 'shift': true } ); }, function () { return $('#example tbody tr:eq(0) td:eq(0)').hasClass('sorting_1') && $('#example tbody tr:eq(0) td:eq(1)').hasClass('sorting_2'); } ); oTest.fnWaitTest( "Sorting multi-column - add column 2", function () { oDispacher.click( $('#example thead th:eq(2)')[0], { 'shift': true } ); }, function () { return $('#example tbody tr:eq(0) td:eq(0)').hasClass('sorting_1') && $('#example tbody tr:eq(0) td:eq(1)').hasClass('sorting_2') && $('#example tbody tr:eq(0) td:eq(2)').hasClass('sorting_3'); } ); oTest.fnWaitTest( "Sorting multi-column - add column 3", function () { oDispacher.click( $('#example thead th:eq(3)')[0], { 'shift': true } ); }, function () { return $('#example tbody tr:eq(0) td:eq(0)').hasClass('sorting_1') && $('#example tbody tr:eq(0) td:eq(1)').hasClass('sorting_2') && $('#example tbody tr:eq(0) td:eq(2)').hasClass('sorting_3') && $('#example tbody tr:eq(0) td:eq(3)').hasClass('sorting_3'); } ); oTest.fnWaitTest( "Remove sorting classes on single column sort", function () { $('#example thead th:eq(4)').click(); }, function () { return $('#example tbody tr:eq(0) td:eq(0)').hasClass('sorting_1') == false && $('#example tbody tr:eq(0) td:eq(1)').hasClass('sorting_2') == false && $('#example tbody tr:eq(0) td:eq(2)').hasClass('sorting_3') == false && $('#example tbody tr:eq(0) td:eq(3)').hasClass('sorting_3') == false; } ); oTest.fnWaitTest( "Sorting class 1 was added", null, function () { return $('#example tbody tr:eq(1) td:eq(4)').hasClass('sorting_1'); } ); /* Check can disable */ oTest.fnWaitTest( "Sorting classes can be disabled", function () { oSession.fnRestore(); $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt", "bSortClasses": false } ); }, function () { return $('#example tbody tr:eq(0) td:eq(0)').hasClass('sorting_1') == false; } ); oTest.fnWaitTest( "Sorting classes disabled - add column 1 - no effect", function () { oDispacher.click( $('#example thead th:eq(1)')[0], { 'shift': true } ); }, function () { return $('#example tbody tr:eq(0) td:eq(0)').hasClass('sorting_1') == false && $('#example tbody tr:eq(0) td:eq(1)').hasClass('sorting_2') == false; } ); oTest.fnWaitTest( "Sorting classes disabled - add column 2 - no effect", function () { oDispacher.click( $('#example thead th:eq(2)')[0], { 'shift': true } ); }, function () { return $('#example tbody tr:eq(0) td:eq(0)').hasClass('sorting_1') == false && $('#example tbody tr:eq(0) td:eq(1)').hasClass('sorting_2') == false && $('#example tbody tr:eq(0) td:eq(2)').hasClass('sorting_3') == false; } ); /* Enable makes no difference */ oTest.fnWaitTest( "Sorting classes enabled override", function () { oSession.fnRestore(); $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt", "bSortClasses": true } ); }, function () { return $('#example tbody tr:eq(0) td:eq(0)').hasClass('sorting_1'); } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/3_ajax/fnCreatedCell.js000077500000000000000000000074741265711500300244130ustar00rootroot00000000000000// DATA_TEMPLATE: empty_table oTest.fnStart( "fnCreatedCell tests" ); $(document).ready( function () { var tmp = 0; var complete = false; $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt", "aoColumnDefs": [ { fnCreatedCell: function () { tmp++; }, "aTargets": ["_all"] } ] } ); oTest.fnWaitTest( "Cell created is called once for each cell on init", null, function () { return tmp===285; } ); oTest.fnTest( "Created isn't called back on other draws", function () { $('#example th:eq(1)').click(); }, function () { return tmp===285; } ); oTest.fnWaitTest( "Four arguments for the function", function () { oSession.fnRestore(); tmp = true; complete = false; $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt", "aoColumnDefs": [ { fnCreatedRow: function () { if ( arguments.length !== 4 ) { tmp = false; } }, "aTargets": ["_all"] } ], fnInitComplete: function () { complete = true; } } ); }, function () { return (tmp && complete); } ); oTest.fnWaitTest( "First argument is a TD element", function () { oSession.fnRestore(); tmp = true; complete = false; $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt", "aoColumnDefs": [ { fnCreatedRow: function () { if ( arguments[0].nodeName !== "TD" ) { tmp = false; } }, "aTargets": ["_all"] } ], fnInitComplete: function () { complete = true; } } ); }, function () { return (tmp && complete); } ); oTest.fnWaitTest( "Second argument is the HTML value", function () { oSession.fnRestore(); tmp = true; complete = false; $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt", "aoColumnDefs": [ { fnCreatedRow: function () { if ( arguments[1] != $('td').html() ) { tmp = false; } }, "aTargets": ["_all"] } ], fnInitComplete: function () { complete = true; } } ); }, function () { return (tmp && complete); } ); oTest.fnWaitTest( "Third argument is the data array", function () { oSession.fnRestore(); tmp = true; complete = false; $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt", "aoColumnDefs": [ { fnCreatedRow: function () { if ( arguments[2].length !== 5 ) { tmp = false; } }, "aTargets": ["_all"] } ], fnInitComplete: function () { complete = true; } } ); }, function () { return (tmp && complete); } ); oTest.fnWaitTest( "Fourth argument is the data source for the row", function () { oSession.fnRestore(); tmp = true; complete = false; $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt", "aoColumnDefs": [ { fnCreatedRow: function () { if ( arguments[2] !== this.fnSettings().aoData[ arguments[2] ]._aData ) { tmp = false; } }, "aTargets": ["_all"] } ], fnInitComplete: function () { complete = true; } } ); }, function () { return (tmp && complete); } ); oTest.fnWaitTest( "Fifth argument is the the col index", function () { oSession.fnRestore(); tmp = true; complete = false; $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt", "aoColumnDefs": [ { fnCreatedRow: function () { if ( arguments[1] != $('td:eq('+arguments[4]+')', arguments[0].parentNode).html() ) { tmp = false; } }, "aTargets": ["_all"] } ], fnInitComplete: function () { complete = true; } } ); }, function () { return (tmp && complete); } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/3_ajax/fnCreatedRow.js000077500000000000000000000057211265711500300242740ustar00rootroot00000000000000// DATA_TEMPLATE: empty_table oTest.fnStart( "fnCreatedRow tests" ); $(document).ready( function () { var tmp = 0; var complete = false; $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt", fnCreatedRow: function () { tmp++; } } ); oTest.fnWaitTest( "Row created is called once for each row on init", null, function () { return tmp===57; } ); oTest.fnTest( "Created isn't called back on other draws", function () { $('#example th:eq(1)').click(); }, function () { return tmp===57; } ); oTest.fnWaitTest( "Three arguments for the function", function () { oSession.fnRestore(); tmp = true; complete = false; $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt", fnCreatedRow: function () { if ( arguments.length !== 3 ) { tmp = false; } }, fnInitComplete: function () { complete = true; } } ); }, function () { return (tmp && complete); } ); oTest.fnWaitTest( "First argument is a TR element", function () { oSession.fnRestore(); tmp = true; complete = false; $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt", fnCreatedRow: function () { if ( arguments[0].nodeName !== "TR" ) { tmp = false; } }, fnInitComplete: function () { complete = true; } } ); }, function () { return (tmp && complete); } ); oTest.fnWaitTest( "Second argument is an array with 5 elements", function () { oSession.fnRestore(); tmp = true; complete = false; $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt", fnCreatedRow: function () { if ( arguments[1].length !== 5 ) { tmp = false; } }, fnInitComplete: function () { complete = true; } } ); }, function () { return (tmp && complete); } ); oTest.fnWaitTest( "Third argument is the data source for the row", function () { oSession.fnRestore(); tmp = true; complete = false; $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt", fnCreatedRow: function () { if ( arguments[1] !== this.fnSettings().aoData[ arguments[2] ]._aData ) { tmp = false; } }, fnInitComplete: function () { complete = true; } } ); }, function () { return (tmp && complete); } ); oTest.fnWaitTest( "TR element is tied to the correct data", function () { oSession.fnRestore(); tmp = false; complete = false; $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt", fnCreatedRow: function (tr, data, index) { if ( data[1] === "Firefox 1.0" ) { if ( $('td:eq(3)', tr).html() == "1.7" ) { tmp = true; } } }, fnInitComplete: function () { complete = true; } } ); }, function () { return (tmp && complete); } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/3_ajax/fnDrawCallback.js000066400000000000000000000041131265711500300245360ustar00rootroot00000000000000// DATA_TEMPLATE: empty_table oTest.fnStart( "fnDrawCallback" ); /* Fairly boring function compared to the others! */ $(document).ready( function () { /* Check the default */ var oTable = $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt" } ); var oSettings = oTable.fnSettings(); var mPass, bInit; oTest.fnWaitTest( "Default should be null", null, function () { return oSettings.fnDrawCallback == null; } ); oTest.fnWaitTest( "One argument passed", function () { oSession.fnRestore(); mPass = -1; bInit = false; $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt", "fnDrawCallback": function ( ) { mPass = arguments.length; }, "fnInitComplete": function () { bInit = true; } } ); }, function () { return mPass == 1 && bInit; } ); oTest.fnWaitTest( "That one argument is the settings object", function () { oSession.fnRestore(); bInit = false; oTable = $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt", "fnDrawCallback": function ( oSettings ) { mPass = oSettings; }, "fnInitComplete": function () { bInit = true; } } ); }, function () { return oTable.fnSettings() == mPass && bInit; } ); /* The draw callback is called once for the init and then when the data is added */ oTest.fnWaitTest( "fnRowCallback called once on first draw", function () { oSession.fnRestore(); mPass = 0; bInit = false; $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt", "fnDrawCallback": function ( ) { mPass++; }, "fnInitComplete": function () { bInit = true; } } ); }, function () { return mPass == 2 && bInit; } ); oTest.fnWaitTest( "fnRowCallback called once on each draw there after as well", function () { $('#example_next').click(); $('#example_next').click(); $('#example_next').click(); }, function () { return mPass == 5; } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/3_ajax/fnHeaderCallback.js000066400000000000000000000104211265711500300250300ustar00rootroot00000000000000// DATA_TEMPLATE: empty_table oTest.fnStart( "fnHeaderCallback" ); $(document).ready( function () { /* Check the default */ var oTable = $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt" } ); var oSettings = oTable.fnSettings(); var mPass, bInit; oTest.fnWaitTest( "Default should be null", null, function () { return oSettings.fnHeaderCallback == null; } ); oTest.fnWaitTest( "Five arguments passed", function () { oSession.fnRestore(); mPass = -1; bInit = false; $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt", "fnHeaderCallback": function ( ) { mPass = arguments.length; }, "fnInitComplete": function () { bInit = true; } } ); }, function () { return mPass == 5 && bInit; } ); /* The header callback is called once for the init and then when the data is added */ oTest.fnWaitTest( "fnHeaderCallback called once per draw", function () { oSession.fnRestore(); mPass = 0; bInit = false; $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt", "fnHeaderCallback": function ( nHead, aasData, iStart, iEnd, aiDisplay ) { mPass++; }, "fnInitComplete": function () { bInit = true; } } ); }, function () { return mPass == 2 && bInit; } ); oTest.fnWaitTest( "fnRowCallback called on paging (i.e. another draw)", function () { $('#example_next').click(); }, function () { return mPass == 3; } ); oTest.fnWaitTest( "fnRowCallback allows us to alter row information", function () { oSession.fnRestore(); $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt", "fnHeaderCallback": function ( nHead, aasData, iStart, iEnd, aiDisplay ) { nHead.getElementsByTagName('th')[0].innerHTML = "Displaying "+(iEnd-iStart)+" records"; } } ); }, function () { return $('#example thead th:eq(0)').html() == "Displaying 10 records"; } ); oTest.fnWaitTest( "iStart correct on first page", function () { oSession.fnRestore(); mPass = true; $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt", "fnHeaderCallback": function ( nHead, aasData, iStart, iEnd, aiDisplay ) { if ( iStart != 0 ) { mPass = false; } } } ); }, function () { return mPass; } ); oTest.fnWaitTest( "iStart correct on second page", function () { oSession.fnRestore(); mPass = false; $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt", "fnHeaderCallback": function ( nHead, aasData, iStart, iEnd, aiDisplay ) { if ( iStart == 10 ) { mPass = true; } }, "fnInitComplete": function () { $('#example_next').click(); } } ); }, function () { return mPass; } ); oTest.fnWaitTest( "iEnd correct on second page", function () { oSession.fnRestore(); mPass = false; $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt", "fnHeaderCallback": function ( nHead, aasData, iStart, iEnd, aiDisplay ) { if ( iEnd == 20 ) { mPass = true; } }, "fnInitComplete": function () { $('#example_next').click(); } } ); }, function () { return mPass; } ); oTest.fnWaitTest( "aiDisplay length is full data when not filtered", function () { oSession.fnRestore(); mPass = false; $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt", "fnHeaderCallback": function ( nHead, aasData, iStart, iEnd, aiDisplay ) { if ( aiDisplay.length == 57 ) { mPass = true; } } } ); }, function () { return mPass; } ); oTest.fnWaitTest( "aiDisplay length is 9 when filtering on 'Mozilla'", function () { oSession.fnRestore(); mPass = false; oTable = $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt", "fnHeaderCallback": function ( nHead, aasData, iStart, iEnd, aiDisplay ) { if ( aiDisplay.length == 9 ) { mPass = true; } } } ); oTable.fnFilter( "Mozilla" ); }, function () { return mPass; } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/3_ajax/fnInitComplete.js000066400000000000000000000041001265711500300246140ustar00rootroot00000000000000// DATA_TEMPLATE: empty_table oTest.fnStart( "fnInitComplete" ); /* Fairly boring function compared to the others! */ $(document).ready( function () { /* Check the default */ var oTable = $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt" } ); var oSettings = oTable.fnSettings(); var mPass; oTest.fnWaitTest( "Default should be null", null, function () { return oSettings.fnInitComplete == null; } ); oTest.fnWaitTest( "Two arguments passed (for Ajax!)", function () { oSession.fnRestore(); mPass = -1; $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt", "fnInitComplete": function ( ) { mPass = arguments.length; } } ); }, function () { return mPass == 2; } ); oTest.fnWaitTest( "That one argument is the settings object", function () { oSession.fnRestore(); oTable = $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt", "fnInitComplete": function ( oSettings ) { mPass = oSettings; } } ); }, function () { return oTable.fnSettings() == mPass; } ); oTest.fnWaitTest( "fnInitComplete called once on first draw", function () { oSession.fnRestore(); mPass = 0; $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt", "fnInitComplete": function ( ) { mPass++; } } ); }, function () { return mPass == 1; } ); oTest.fnWaitTest( "fnInitComplete never called there after", function () { $('#example_next').click(); $('#example_next').click(); $('#example_next').click(); }, function () { return mPass == 1; } ); oTest.fnWaitTest( "10 rows in the table on complete", function () { oSession.fnRestore(); mPass = 0; $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt", "fnInitComplete": function ( ) { mPass = $('#example tbody tr').length; } } ); }, function () { return mPass == 10; } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/3_ajax/fnRowCallback.js000066400000000000000000000050011265711500300244050ustar00rootroot00000000000000// DATA_TEMPLATE: empty_table oTest.fnStart( "fnRowCallback" ); /* Note - fnRowCallback MUST return the first arguments (modified or not) */ $(document).ready( function () { /* Check the default */ var oTable = $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt" } ); var oSettings = oTable.fnSettings(); var mPass; oTest.fnWaitTest( "Default should be null", null, function () { return oSettings.fnRowCallback == null; } ); oTest.fnWaitTest( "Four arguments passed", function () { oSession.fnRestore(); mPass = -1; $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt", "fnRowCallback": function ( nTr ) { mPass = arguments.length; return nTr; } } ); }, function () { return mPass == 4; } ); oTest.fnWaitTest( "fnRowCallback called once for each drawn row", function () { oSession.fnRestore(); mPass = 0; $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt", "fnRowCallback": function ( nTr, asData, iDrawIndex, iDataIndex ) { mPass++; return nTr; } } ); }, function () { return mPass == 10; } ); oTest.fnWaitTest( "fnRowCallback allows us to alter row information", function () { oSession.fnRestore(); $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt", "fnRowCallback": function ( nTr, asData, iDrawIndex, iDataIndex ) { $(nTr).addClass('unit_test'); return nTr; } } ); }, function () { return $('#example tbody tr:eq(1)').hasClass('unit_test'); } ); oTest.fnWaitTest( "Data array has length matching columns", function () { oSession.fnRestore(); mPass = true; $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt", "fnRowCallback": function ( nTr, asData, iDrawIndex, iDataIndex ) { if ( asData.length != 5 ) mPass = false; return nTr; } } ); }, function () { return mPass; } ); oTest.fnWaitTest( "Data array has length matching columns", function () { oSession.fnRestore(); mPass = true; var iCount = 0; $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt", "fnRowCallback": function ( nTr, asData, iDrawIndex, iDataIndex ) { if ( iCount != iDrawIndex ) mPass = false; iCount++; return nTr; } } ); }, function () { return mPass; } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/3_ajax/fnServerData.js000066400000000000000000000026471265711500300242760ustar00rootroot00000000000000// DATA_TEMPLATE: empty_table oTest.fnStart( "fnServerData for Ajax sourced data" ); $(document).ready( function () { var mPass; oTest.fnTest( "Argument length", function () { $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt", "fnServerData": function () { mPass = arguments.length; } } ); }, function () { return mPass == 4; } ); oTest.fnTest( "Url", function () { $('#example').dataTable( { "bDestroy": true, "sAjaxSource": "../../../examples/ajax/sources/arrays.txt", "fnServerData": function (sUrl, aoData, fnCallback, oSettings) { mPass = sUrl == "../../../examples/ajax/sources/arrays.txt"; } } ); }, function () { return mPass; } ); oTest.fnTest( "Data array", function () { $('#example').dataTable( { "bDestroy": true, "sAjaxSource": "../../../examples/ajax/sources/arrays.txt", "fnServerData": function (sUrl, aoData, fnCallback, oSettings) { mPass = aoData.length==0; } } ); }, function () { return mPass; } ); oTest.fnTest( "Callback function", function () { $('#example').dataTable( { "bDestroy": true, "sAjaxSource": "../../../examples/ajax/sources/arrays.txt", "fnServerData": function (sUrl, aoData, fnCallback, oSettings) { mPass = typeof fnCallback == 'function'; } } ); }, function () { return mPass; } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/3_ajax/fnServerParams.js000066400000000000000000000032341265711500300246410ustar00rootroot00000000000000// DATA_TEMPLATE: empty_table oTest.fnStart( "fnServerParams" ); $(document).ready( function () { /* Check the default */ var json = {}; var oTable = $('#example').dataTable( { "sAjaxSource": "../data_sources/param.php" } ).on('xhr', function (e, settings, o) { json = o; } ); oTest.fnWaitTest( "jQuery anti-cache parameter was sent", null, function () { return json.get && json.get._; } ); oTest.fnWaitTest( "No other parameters sent", null, function () { return 1 === $.map( json.get, function (val) { return val; } ).length; } ); oTest.fnWaitTest( "Send additional parameters", function () { oSession.fnRestore(); json = {}; $('#example').dataTable( { "sAjaxSource": "../data_sources/param.php", "fnServerParams": function ( data ) { data.push( { name: 'test', value: 'unit' } ); } } ).on('xhr', function (e, settings, o) { json = o; } ); }, function () { return json.get && json.get.test === 'unit'; } ); oTest.fnTest( "jQuery anti-cache parameter was still sent", null, function () { return json.get._; } ); oTest.fnWaitTest( "Send multiple parameters", function () { oSession.fnRestore(); json = {}; $('#example').dataTable( { "sAjaxSource": "../data_sources/param.php", "fnServerParams": function ( data ) { data.push( { name: 'test', value: 'unit' } ); data.push( { name: 'tapestry', value: 'king' } ); } } ).on('xhr', function (e, settings, o) { json = o; } ); }, function () { return json.get && json.get.test === 'unit' && json.get.tapestry === 'king'; } ); oTest.fnComplete(); } ); DataTablesSrc-1.10.11/tests/tests_onhold/3_ajax/iDisplayLength.js000066400000000000000000000034171265711500300246260ustar00rootroot00000000000000// DATA_TEMPLATE: empty_table oTest.fnStart( "iDisplayLength" ); $(document).ready( function () { /* Check the default */ $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt" } ); oTest.fnWaitTest( "Default length is ten", null, function () { return $('#example tbody tr').length == 10; } ); oTest.fnWaitTest( "Select menu shows 10", null, function () { return $('#example_length select').val() == 10; } ); oTest.fnWaitTest( "Set initial length to 25", function () { oSession.fnRestore(); $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt", "iDisplayLength": 25 } ); }, function () { return $('#example tbody tr').length == 25; } ); oTest.fnWaitTest( "Select menu shows 25", null, function () { return $('#example_length select').val() == 25; } ); oTest.fnWaitTest( "Set initial length to 100", function () { oSession.fnRestore(); $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt", "iDisplayLength": 100 } ); }, function () { return $('#example tbody tr').length == 57; } ); oTest.fnWaitTest( "Select menu shows 25", null, function () { return $('#example_length select').val() == 100; } ); oTest.fnWaitTest( "Set initial length to 23 (unknown select menu length)", function () { oSession.fnRestore(); $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt", "iDisplayLength": 23 } ); }, function () { return $('#example tbody tr').length == 23; } ); oTest.fnWaitTest( "Select menu shows 10 (since 23 is unknow)", null, function () { return $('#example_length select').val() == 10; } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/3_ajax/oLanguage.oPaginate.js000066400000000000000000000042571265711500300255210ustar00rootroot00000000000000// DATA_TEMPLATE: empty_table oTest.fnStart( "oLanguage.oPaginate" ); /* Note that the paging language information only has relevence in full numbers */ $(document).ready( function () { /* Check the default */ var oTable = $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt", "sPaginationType": "full_numbers" } ); var oSettings = oTable.fnSettings(); oTest.fnWaitTest( "oLanguage.oPaginate defaults", null, function () { var bReturn = oSettings.oLanguage.oPaginate.sFirst == "First" && oSettings.oLanguage.oPaginate.sPrevious == "Previous" && oSettings.oLanguage.oPaginate.sNext == "Next" && oSettings.oLanguage.oPaginate.sLast == "Last"; return bReturn; } ); oTest.fnTest( "oLanguage.oPaginate defaults are in the DOM", null, function () { var bReturn = $('#example_paginate .first').html() == "First" && $('#example_paginate .previous').html() == "Previous" && $('#example_paginate .next').html() == "Next" && $('#example_paginate .last').html() == "Last"; return bReturn; } ); oTest.fnWaitTest( "oLanguage.oPaginate can be defined", function () { oSession.fnRestore(); oTable = $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt", "sPaginationType": "full_numbers", "oLanguage": { "oPaginate": { "sFirst": "unit1", "sPrevious": "test2", "sNext": "unit3", "sLast": "test4" } } } ); oSettings = oTable.fnSettings(); }, function () { var bReturn = oSettings.oLanguage.oPaginate.sFirst == "unit1" && oSettings.oLanguage.oPaginate.sPrevious == "test2" && oSettings.oLanguage.oPaginate.sNext == "unit3" && oSettings.oLanguage.oPaginate.sLast == "test4"; return bReturn; } ); oTest.fnTest( "oLanguage.oPaginate definitions are in the DOM", null, function () { var bReturn = $('#example_paginate .first').html() == "unit1" && $('#example_paginate .previous').html() == "test2" && $('#example_paginate .next').html() == "unit3" && $('#example_paginate .last').html() == "test4"; return bReturn; } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/3_ajax/oLanguage.sInfo.js000066400000000000000000000062301265711500300246610ustar00rootroot00000000000000// DATA_TEMPLATE: empty_table oTest.fnStart( "oLanguage.sInfo" ); $(document).ready( function () { /* Check the default */ var oTable = $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt" } ); var oSettings = oTable.fnSettings(); oTest.fnWaitTest( "Info language is 'Showing _START_ to _END_ of _TOTAL_ entries' by default", null, function () { return oSettings.oLanguage.sInfo == "Showing _START_ to _END_ of _TOTAL_ entries"; } ); oTest.fnTest( "Info language default is in the DOM", null, function () { return document.getElementById('example_info').innerHTML = "Showing 1 to 10 of 57 entries"; } ); oTest.fnWaitTest( "Info language can be defined - without any macros", function () { oSession.fnRestore(); oTable = $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt", "oLanguage": { "sInfo": "unit test" } } ); oSettings = oTable.fnSettings(); }, function () { return oSettings.oLanguage.sInfo == "unit test"; } ); oTest.fnTest( "Info language definition is in the DOM", null, function () { return document.getElementById('example_info').innerHTML = "unit test"; } ); oTest.fnWaitTest( "Info language can be defined - with macro _START_ only", function () { oSession.fnRestore(); $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt", "oLanguage": { "sInfo": "unit _START_ test" } } ); }, function () { return document.getElementById('example_info').innerHTML = "unit 1 test"; } ); oTest.fnWaitTest( "Info language can be defined - with macro _END_ only", function () { oSession.fnRestore(); $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt", "oLanguage": { "sInfo": "unit _END_ test" } } ); }, function () { return document.getElementById('example_info').innerHTML = "unit 10 test"; } ); oTest.fnWaitTest( "Info language can be defined - with macro _TOTAL_ only", function () { oSession.fnRestore(); $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt", "oLanguage": { "sInfo": "unit _END_ test" } } ); }, function () { return document.getElementById('example_info').innerHTML = "unit 57 test"; } ); oTest.fnWaitTest( "Info language can be defined - with macros _START_ and _END_", function () { oSession.fnRestore(); $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt", "oLanguage": { "sInfo": "unit _START_ _END_ test" } } ); }, function () { return document.getElementById('example_info').innerHTML = "unit 1 10 test"; } ); oTest.fnWaitTest( "Info language can be defined - with macros _START_, _END_ and _TOTAL_", function () { oSession.fnRestore(); $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt", "oLanguage": { "sInfo": "unit _START_ _END_ _TOTAL_ test" } } ); }, function () { return document.getElementById('example_info').innerHTML = "unit 1 10 57 test"; } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/3_ajax/oLanguage.sInfoEmpty.js000066400000000000000000000040551265711500300257030ustar00rootroot00000000000000// DATA_TEMPLATE: empty_table oTest.fnStart( "oLanguage.sInfoEmpty" ); $(document).ready( function () { /* Check the default */ var oTable = $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt" } ); var oSettings = oTable.fnSettings(); oTest.fnWaitTest( "Info empty language is 'Showing 0 to 0 of 0 entries' by default", function () { oTable.fnFilter("nothinghere"); }, function () { return oSettings.oLanguage.sInfoEmpty == "Showing 0 to 0 of 0 entries"; } ); oTest.fnTest( "Info empty language default is in the DOM", null, function () { var bReturn = document.getElementById('example_info').innerHTML.replace( ' '+oSettings.oLanguage.sInfoFiltered.replace( '_MAX_', '57' ), "" ) == "Showing 0 to 0 of 0 entries"; return bReturn; } ); oTest.fnWaitTest( "Info empty language can be defined", function () { oSession.fnRestore(); oTable = $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt", "oLanguage": { "sInfoEmpty": "unit test" } } ); oSettings = oTable.fnSettings(); oTable.fnFilter("nothinghere"); }, function () { return oSettings.oLanguage.sInfoEmpty == "unit test"; } ); oTest.fnTest( "Info empty language default is in the DOM", null, function () { var bReturn = document.getElementById('example_info').innerHTML.replace( ' '+oSettings.oLanguage.sInfoFiltered.replace( '_MAX_', '57' ), "" ) == "unit test"; return bReturn; } ); oTest.fnWaitTest( "Macro's replaced", function () { oSession.fnRestore(); oTable = $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt", "oLanguage": { "sInfoEmpty": "unit _START_ _END_ _TOTAL_ test" } } ); oTable.fnFilter("nothinghere"); }, function () { var bReturn = document.getElementById('example_info').innerHTML.replace( ' '+oSettings.oLanguage.sInfoFiltered.replace( '_MAX_', '57' ), "" ) == "unit 1 0 0 test"; return bReturn; } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/3_ajax/oLanguage.sInfoPostFix.js000066400000000000000000000041621265711500300262000ustar00rootroot00000000000000// DATA_TEMPLATE: empty_table oTest.fnStart( "oLanguage.sInfoPostFix" ); $(document).ready( function () { /* Check the default */ var oTable = $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt" } ); var oSettings = oTable.fnSettings(); oTest.fnWaitTest( "Info post fix language is '' (blank) by default", null, function () { return oSettings.oLanguage.sInfoPostFix == ""; } ); oTest.fnTest( "Width no post fix, the basic info shows", null, function () { return document.getElementById('example_info').innerHTML = "Showing 1 to 10 of 57 entries"; } ); oTest.fnWaitTest( "Info post fix language can be defined", function () { oSession.fnRestore(); oTable = $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt", "oLanguage": { "sInfoPostFix": "unit test" } } ); oSettings = oTable.fnSettings(); }, function () { return oSettings.oLanguage.sInfoPostFix == "unit test"; } ); oTest.fnTest( "Info empty language default is in the DOM", null, function () { return document.getElementById('example_info').innerHTML = "Showing 1 to 10 of 57 entries unit test"; } ); oTest.fnWaitTest( "Macros have no effect in the post fix", function () { oSession.fnRestore(); oTable = $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt", "oLanguage": { "sInfoPostFix": "unit _START_ _END_ _TOTAL_ test" } } ); }, function () { return document.getElementById('example_info').innerHTML = "Showing 1 to 10 of 57 entries unit _START_ _END_ _TOTAL_ test"; } ); oTest.fnWaitTest( "Post fix is applied after fintering info", function () { oSession.fnRestore(); oTable = $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt", "oLanguage": { "sInfoPostFix": "unit test" } } ); oTable.fnFilter("nothinghere"); }, function () { return document.getElementById('example_info').innerHTML = "Showing 0 to 0 of 0 entries unit (filtered from 57 total entries) test"; } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/3_ajax/oLanguage.sLengthMenu.js000066400000000000000000000051741265711500300260420ustar00rootroot00000000000000// DATA_TEMPLATE: empty_table oTest.fnStart( "oLanguage.sLengthMenu" ); $(document).ready( function () { /* Check the default */ var oTable = $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt" } ); var oSettings = oTable.fnSettings(); oTest.fnWaitTest( "Menu language is 'Show _MENU_ entries' by default", null, function () { return oSettings.oLanguage.sLengthMenu == "Show _MENU_ entries"; } ); oTest.fnTest( "_MENU_ macro is replaced by select menu in DOM", null, function () { return $('select', oSettings.aanFeatures.l[0]).length == 1 } ); oTest.fnTest( "A label input is used", null, function () { return $('label', oSettings.aanFeatures.l[0]).length == 1 } ); oTest.fnTest( "Default is put into DOM", null, function () { var anChildren = $('label',oSettings.aanFeatures.l[0])[0].childNodes; var bReturn = anChildren[0].nodeValue == "Show " && anChildren[2].nodeValue == " entries"; return bReturn; } ); oTest.fnWaitTest( "Menu length language can be defined - no _MENU_ macro", function () { oSession.fnRestore(); oTable = $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt", "oLanguage": { "sLengthMenu": "unit test" } } ); oSettings = oTable.fnSettings(); }, function () { return oSettings.oLanguage.sLengthMenu == "unit test"; } ); oTest.fnTest( "Menu length language definition is in the DOM", null, function () { return $('label', oSettings.aanFeatures.l[0]).text() == "unit test"; } ); oTest.fnWaitTest( "Menu length language can be defined - with _MENU_ macro", function () { oSession.fnRestore(); oTable = $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt", "oLanguage": { "sLengthMenu": "unit _MENU_ test" } } ); oSettings = oTable.fnSettings(); }, function () { var anChildren = $('label',oSettings.aanFeatures.l[0])[0].childNodes; var bReturn = anChildren[0].nodeValue == "unit " && anChildren[2].nodeValue == " test"; return bReturn; } ); oTest.fnWaitTest( "Only the _MENU_ macro", function () { oSession.fnRestore(); oTable = $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt", "oLanguage": { "sLengthMenu": "_MENU_" } } ); oSettings = oTable.fnSettings(); }, function () { var anChildren = oSettings.aanFeatures.l[0].childNodes; var bReturn = anChildren.length == 1 && $('select', oSettings.aanFeatures.l[0]).length == 1; return bReturn; } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/3_ajax/oLanguage.sLoadingRecords.js000066400000000000000000000031301265711500300266610ustar00rootroot00000000000000// DATA_TEMPLATE: empty_table oTest.fnStart( "oLanguage.sLoadingRecords" ); $(document).ready( function () { var tmp = false; oTest.fnTest( "Default loading text is 'Loading...'", function () { $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt" } ); tmp = $('#example tbody tr td')[0].innerHTML == "Loading..."; }, function () { return tmp; } ); oTest.fnTest( "Text can be overriden", function () { oSession.fnRestore(); $('#example').dataTable( { "oLanguage": { "sLoadingRecords": "unitest" }, "sAjaxSource": "../../../examples/ajax/sources/arrays.txt" } ); tmp = $('#example tbody tr td')[0].innerHTML == "unitest"; }, function () { return tmp; } ); oTest.fnTest( "When sZeroRecords is given but sLoadingRecords is not, sZeroRecords is used", function () { oSession.fnRestore(); $('#example').dataTable( { "oLanguage": { "sZeroRecords": "unitest_sZeroRecords" }, "sAjaxSource": "../../../examples/ajax/sources/arrays.txt" } ); tmp = $('#example tbody tr td')[0].innerHTML == "unitest_sZeroRecords"; }, function () { return tmp; } ); oTest.fnTest( "sLoadingRecords and sZeroRecords both given", function () { oSession.fnRestore(); $('#example').dataTable( { "oLanguage": { "sZeroRecords": "unitest_sZeroRecords2", "sLoadingRecords": "unitest2" }, "sAjaxSource": "../../../examples/ajax/sources/arrays.txt" } ); tmp = $('#example tbody tr td')[0].innerHTML == "unitest2"; }, function () { return tmp; } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/3_ajax/oLanguage.sProcessing.js000066400000000000000000000023601265711500300261020ustar00rootroot00000000000000// DATA_TEMPLATE: empty_table oTest.fnStart( "oLanguage.sProcessing" ); $(document).ready( function () { /* Check the default */ var oTable = $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt", "bProcessing": true } ); var oSettings = oTable.fnSettings(); oTest.fnWaitTest( "Processing language is 'Processing...' by default", null, function () { return oSettings.oLanguage.sProcessing == "Processing..."; } ); oTest.fnTest( "Processing language default is in the DOM", null, function () { return document.getElementById('example_processing').innerHTML = "Processing..."; } ); oTest.fnWaitTest( "Processing language can be defined", function () { oSession.fnRestore(); oTable = $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt", "bProcessing": true, "oLanguage": { "sProcessing": "unit test" } } ); oSettings = oTable.fnSettings(); }, function () { return oSettings.oLanguage.sProcessing == "unit test"; } ); oTest.fnTest( "Processing language definition is in the DOM", null, function () { return document.getElementById('example_processing').innerHTML = "unit test"; } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/3_ajax/oLanguage.sSearch.js000066400000000000000000000032521265711500300251740ustar00rootroot00000000000000// DATA_TEMPLATE: empty_table oTest.fnStart( "oLanguage.sSearch" ); $(document).ready( function () { /* Check the default */ var oTable = $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt" } ); var oSettings = oTable.fnSettings(); oTest.fnWaitTest( "Search language is 'Search:' by default", null, function () { return oSettings.oLanguage.sSearch == "Search:"; } ); oTest.fnTest( "A label input is used", null, function () { return $('label', oSettings.aanFeatures.f[0]).length == 1 } ); oTest.fnTest( "Search language default is in the DOM", null, function () { return $('label', oSettings.aanFeatures.f[0]).text() == "Search: "; } ); oTest.fnWaitTest( "Search language can be defined", function () { oSession.fnRestore(); oTable = $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt", "oLanguage": { "sSearch": "unit test" } } ); oSettings = oTable.fnSettings(); }, function () { return oSettings.oLanguage.sSearch == "unit test"; } ); oTest.fnTest( "Info language definition is in the DOM", null, function () { return $('label', oSettings.aanFeatures.f[0]).text().indexOf('unit test') !== -1; } ); oTest.fnWaitTest( "Blank search has a no space (separator) inserted", function () { oSession.fnRestore(); oTable = $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt", "oLanguage": { "sSearch": "" } } ); oSettings = oTable.fnSettings(); }, function () { return document.getElementById('example_filter').childNodes.length == 1; } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/3_ajax/oLanguage.sUrl.js000066400000000000000000000037171265711500300245370ustar00rootroot00000000000000// DATA_TEMPLATE: empty_table oTest.fnStart( "oLanguage.sUrl" ); /* Note that we only test the internal storage of language information pulled form a file here * as the other language tests will check it goes into the DOM correctly */ $(document).ready( function () { /* Check the default */ var oTable = $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt" } ); var oSettings = oTable.fnSettings(); oTest.fnTest( "sUrl is blank by default", null, function () { return oSettings.oLanguage.sUrl == ""; } ); oTest.fnWaitTest( "Loading of German file loads language information", function () { oSession.fnRestore(); oTable = $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt", "oLanguage": { "sUrl": "../../../examples/examples_support/de_DE.txt" } } ); oSettings = oTable.fnSettings(); }, function () { var bReturn = oSettings.oLanguage.sProcessing == "Bitte warten..." && oSettings.oLanguage.sLengthMenu == "_MENU_ Einträge anzeigen" && oSettings.oLanguage.sZeroRecords == "Keine Einträge vorhanden." && oSettings.oLanguage.sInfo == "_START_ bis _END_ von _TOTAL_ Einträgen" && oSettings.oLanguage.sInfoEmpty == "0 bis 0 von 0 Einträgen" && oSettings.oLanguage.sInfoFiltered == "(gefiltert von _MAX_ Einträgen)" && oSettings.oLanguage.sInfoPostFix == "" && oSettings.oLanguage.sSearch == "Suchen" && oSettings.oLanguage.oPaginate.sFirst == "Erster" && oSettings.oLanguage.oPaginate.sPrevious == "Zurück" && oSettings.oLanguage.oPaginate.sNext == "Nächster" && oSettings.oLanguage.oPaginate.sLast == "Letzter"; return bReturn; } ); /* One DOM check just to ensure that they go into the DOM */ oTest.fnTest( "Loaded language goes into the DOM", null, function () { return document.getElementById('example_info').innerHTML = "1 bis 10 von 57 Einträgen"; } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/3_ajax/oLanguage.sZeroRecords.js000066400000000000000000000024641265711500300262340ustar00rootroot00000000000000// DATA_TEMPLATE: empty_table oTest.fnStart( "oLanguage.sZeroRecords" ); $(document).ready( function () { /* Check the default */ var oTable = $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt" } ); var oSettings = oTable.fnSettings(); oTest.fnWaitTest( "Zero records language is 'No matching records found' by default", null, function () { return oSettings.oLanguage.sZeroRecords == "No matching records found"; } ); oTest.fnWaitTest( "Text is shown when empty table (after filtering)", function () { oTable.fnFilter('nothinghere'); }, function () { return $('#example tbody tr td')[0].innerHTML == "No matching records found" } ); oTest.fnWaitTest( "Zero records language can be defined", function () { oSession.fnRestore(); oTable = $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt", "oLanguage": { "sZeroRecords": "unit test" } } ); oSettings = oTable.fnSettings(); }, function () { return oSettings.oLanguage.sZeroRecords == "unit test"; } ); oTest.fnWaitTest( "Text is shown when empty table (after filtering)", function () { oTable.fnFilter('nothinghere2'); }, function () { return $('#example tbody tr td')[0].innerHTML == "unit test" } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/3_ajax/oSearch.js000066400000000000000000000053101265711500300232640ustar00rootroot00000000000000// DATA_TEMPLATE: empty_table oTest.fnStart( "oSearch" ); $(document).ready( function () { /* Check the default */ var oTable = $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt" } ); var oSettings = oTable.fnSettings(); oTest.fnWaitTest( "Default values should be blank", null, function () { var bReturn = oSettings.oPreviousSearch.sSearch == "" && !oSettings.oPreviousSearch.bRegex; return bReturn; } ); /* This test might be considered iffy since the full object isn't given, but it's reasonable to * expect DataTables to cope with this. It should just assumine regex false */ oTest.fnWaitTest( "Search term only in object", function () { oSession.fnRestore(); oTable = $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt", "oSearch": { "sSearch": "Mozilla" } } ); }, function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == "Gecko"; } ); oTest.fnWaitTest( "New search will kill old one", function () { oTable.fnFilter("Opera"); }, function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == "Presto"; } ); oTest.fnWaitTest( "Search plain text term and escape regex true", function () { oSession.fnRestore(); $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt", "oSearch": { "sSearch": "DS", "bRegex": false } } ); }, function () { return $('#example tbody tr:eq(0) td:eq(1)').html() == "Nintendo DS browser"; } ); oTest.fnWaitTest( "Search plain text term and escape regex false", function () { oSession.fnRestore(); $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt", "oSearch": { "sSearch": "Opera", "bRegex": true } } ); }, function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == "Presto"; } ); oTest.fnWaitTest( "Search regex text term and escape regex true", function () { oSession.fnRestore(); $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt", "oSearch": { "sSearch": "1.*", "bRegex": false } } ); }, function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == "No matching records found"; } ); oTest.fnWaitTest( "Search regex text term and escape regex false", function () { oSession.fnRestore(); $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt", "oSearch": { "sSearch": "1.*", "bRegex": true } } ); }, function () { return $('#example tbody tr:eq(0) td:eq(0)').html() == "Gecko"; } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/3_ajax/sAjaxDataProp.js000066400000000000000000000101761265711500300244070ustar00rootroot00000000000000// DATA_TEMPLATE: empty_table oTest.fnStart( "Custom data source property - property given" ); $(document).ready( function () { var oInit = { "sAjaxSource": "../../../examples/ajax/sources/custom_prop.txt", "sAjaxDataProp": "demo" }; $('#example').dataTable( oInit ); oTest.fnWaitTest( "10 rows shown on the first page", null, function () { return $('#example tbody tr').length == 10; } ); oTest.fnTest( "Initial sort occured", null, function () { return $('#example tbody td:eq(0)').html() == "Gecko"; } ); /* Need to use the WaitTest for sorting due to the setTimeout datatables uses */ oTest.fnTest( "Sorting (first click) on second column", function () { $('#example thead th:eq(1)').click(); }, function () { return $('#example tbody td:eq(1)').html() == "All others"; } ); oTest.fnTest( "Sorting (second click) on second column", function () { $('#example thead th:eq(1)').click(); }, function () { return $('#example tbody td:eq(1)').html() == "Seamonkey 1.1"; } ); oTest.fnTest( "Sorting (third click) on second column", function () { $('#example thead th:eq(1)').click(); }, function () { return $('#example tbody td:eq(1)').html() == "All others"; } ); oTest.fnTest( "Sorting (first click) on numeric column", function () { $('#example thead th:eq(3)').click(); }, function () { return $('#example tbody td:eq(3)').html() == "-"; } ); oTest.fnTest( "Sorting (second click) on numeric column", function () { $('#example thead th:eq(3)').click(); }, function () { return $('#example tbody td:eq(3)').html() == "522.1"; } ); oTest.fnTest( "Sorting multi-column (first click)", function () { $('#example thead th:eq(0)').click(); oDispacher.click( $('#example thead th:eq(1)')[0], { 'shift': true } ); }, function () { var b = $('#example tbody td:eq(0)').html() == "Gecko" && $('#example tbody td:eq(1)').html() == "Camino 1.0"; return b; } ); oTest.fnTest( "Sorting multi-column - sorting second column only", function () { $('#example thead th:eq(1)').click(); }, function () { return $('#example tbody td:eq(1)').html() == "All others"; } ); /* Basic paging */ oTest.fnTest( "Paging to second page", function () { $('#example_next').click(); }, function () { return $('#example tbody td:eq(1)').html() == "IE Mobile"; } ); oTest.fnTest( "Paging to first page", function () { $('#example_previous').click(); }, function () { return $('#example tbody td:eq(1)').html() == "All others"; } ); oTest.fnTest( "Attempting to page back beyond the first page", function () { $('#example_previous').click(); }, function () { return $('#example tbody td:eq(1)').html() == "All others"; } ); /* Changing length */ oTest.fnTest( "Changing table length to 25 records", function () { $("select[name=example_length]").val('25').change(); }, function () { return $('#example tbody tr').length == 25; } ); oTest.fnTest( "Changing table length to 50 records", function () { $("select[name=example_length]").val('50').change(); }, function () { return $('#example tbody tr').length == 50; } ); oTest.fnTest( "Changing table length to 100 records", function () { $("select[name=example_length]").val('100').change(); }, function () { return $('#example tbody tr').length == 57; } ); oTest.fnTest( "Changing table length to 10 records", function () { $("select[name=example_length]").val('10').change(); }, function () { return $('#example tbody tr').length == 10; } ); /* * Information element */ oTest.fnTest( "Information on zero config", null, function () { return document.getElementById('example_info').innerHTML == "Showing 1 to 10 of 57 entries"; } ); oTest.fnTest( "Information on second page", function () { $('#example_next').click(); }, function () { return document.getElementById('example_info').innerHTML == "Showing 11 to 20 of 57 entries"; } ); oTest.fnTest( "Information on third page", function () { $('#example_next').click(); }, function () { return document.getElementById('example_info').innerHTML == "Showing 21 to 30 of 57 entries"; } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/3_ajax/sAjaxDataProp2.js000066400000000000000000000101651265711500300244670ustar00rootroot00000000000000// DATA_TEMPLATE: empty_table oTest.fnStart( "Custom data source property - array only" ); $(document).ready( function () { var oInit = { "sAjaxSource": "../../../examples/ajax/sources/array_only.txt", "sAjaxDataProp": "" }; $('#example').dataTable( oInit ); oTest.fnWaitTest( "10 rows shown on the first page", null, function () { return $('#example tbody tr').length == 10; } ); oTest.fnTest( "Initial sort occured", null, function () { return $('#example tbody td:eq(0)').html() == "Gecko"; } ); /* Need to use the WaitTest for sorting due to the setTimeout datatables uses */ oTest.fnTest( "Sorting (first click) on second column", function () { $('#example thead th:eq(1)').click(); }, function () { return $('#example tbody td:eq(1)').html() == "All others"; } ); oTest.fnTest( "Sorting (second click) on second column", function () { $('#example thead th:eq(1)').click(); }, function () { return $('#example tbody td:eq(1)').html() == "Seamonkey 1.1"; } ); oTest.fnTest( "Sorting (third click) on second column", function () { $('#example thead th:eq(1)').click(); }, function () { return $('#example tbody td:eq(1)').html() == "All others"; } ); oTest.fnTest( "Sorting (first click) on numeric column", function () { $('#example thead th:eq(3)').click(); }, function () { return $('#example tbody td:eq(3)').html() == "-"; } ); oTest.fnTest( "Sorting (second click) on numeric column", function () { $('#example thead th:eq(3)').click(); }, function () { return $('#example tbody td:eq(3)').html() == "522.1"; } ); oTest.fnTest( "Sorting multi-column (first click)", function () { $('#example thead th:eq(0)').click(); oDispacher.click( $('#example thead th:eq(1)')[0], { 'shift': true } ); }, function () { var b = $('#example tbody td:eq(0)').html() == "Gecko" && $('#example tbody td:eq(1)').html() == "Camino 1.0"; return b; } ); oTest.fnTest( "Sorting multi-column - sorting second column only", function () { $('#example thead th:eq(1)').click(); }, function () { return $('#example tbody td:eq(1)').html() == "All others"; } ); /* Basic paging */ oTest.fnTest( "Paging to second page", function () { $('#example_next').click(); }, function () { return $('#example tbody td:eq(1)').html() == "IE Mobile"; } ); oTest.fnTest( "Paging to first page", function () { $('#example_previous').click(); }, function () { return $('#example tbody td:eq(1)').html() == "All others"; } ); oTest.fnTest( "Attempting to page back beyond the first page", function () { $('#example_previous').click(); }, function () { return $('#example tbody td:eq(1)').html() == "All others"; } ); /* Changing length */ oTest.fnTest( "Changing table length to 25 records", function () { $("select[name=example_length]").val('25').change(); }, function () { return $('#example tbody tr').length == 25; } ); oTest.fnTest( "Changing table length to 50 records", function () { $("select[name=example_length]").val('50').change(); }, function () { return $('#example tbody tr').length == 50; } ); oTest.fnTest( "Changing table length to 100 records", function () { $("select[name=example_length]").val('100').change(); }, function () { return $('#example tbody tr').length == 57; } ); oTest.fnTest( "Changing table length to 10 records", function () { $("select[name=example_length]").val('10').change(); }, function () { return $('#example tbody tr').length == 10; } ); /* * Information element */ oTest.fnTest( "Information on zero config", null, function () { return document.getElementById('example_info').innerHTML == "Showing 1 to 10 of 57 entries"; } ); oTest.fnTest( "Information on second page", function () { $('#example_next').click(); }, function () { return document.getElementById('example_info').innerHTML == "Showing 11 to 20 of 57 entries"; } ); oTest.fnTest( "Information on third page", function () { $('#example_next').click(); }, function () { return document.getElementById('example_info').innerHTML == "Showing 21 to 30 of 57 entries"; } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/3_ajax/sAjaxSource.js000066400000000000000000000010151265711500300241250ustar00rootroot00000000000000// DATA_TEMPLATE: empty_table oTest.fnStart( "sAjaxSource" ); /* Sanitfy check really - all the other tests blast this */ $(document).ready( function () { /* Check the default */ var oTable = $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt" } ); var oSettings = oTable.fnSettings(); oTest.fnWaitTest( "Server side is off by default", null, function () { return oSettings.sAjaxSource == "../../../examples/ajax/sources/arrays.txt"; } ); oTest.fnComplete(); } );DataTablesSrc-1.10.11/tests/tests_onhold/3_ajax/sDom.js000066400000000000000000000164241265711500300226120ustar00rootroot00000000000000// DATA_TEMPLATE: empty_table oTest.fnStart( "sDom" ); /* This is going to be brutal on the browser! There is a lot that can be tested here... */ $(document).ready( function () { /* Check the default */ var oTable = $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt" } ); var oSettings = oTable.fnSettings(); oTest.fnWaitTest( "Default DOM varaible", null, function () { return oSettings.sDom == "lfrtip"; } ); oTest.fnWaitTest( "Default DOM in document", null, function () { var nNodes = $('#demo div, #demo table'); var nWrapper = document.getElementById('example_wrapper'); var nLength = document.getElementById('example_length'); var nFilter = document.getElementById('example_filter'); var nInfo = document.getElementById('example_info'); var nPaging = document.getElementById('example_paginate'); var nTable = document.getElementById('example'); var bReturn = nNodes[0] == nWrapper && nNodes[1] == nLength && nNodes[2] == nFilter && nNodes[3] == nTable && nNodes[4] == nInfo && nNodes[5] == nPaging; return bReturn; } ); oTest.fnWaitTest( "Check example 1 in code propagates", function () { oSession.fnRestore(); oTable = $('#example').dataTable( { "sAjaxSource": "../../../examples/ajax/sources/arrays.txt", "sDom": '<"wrapper"flipt>' } ); oSettings = oTable.fnSettings(); }, function () { return oSettings.sDom == '<"wrapper"flipt>'; } ); oTest.fnWaitTest( "Check example 1 in DOM", null, function () { var jqNodes = $('#demo div, #demo table'); var nNodes = []; /* Strip the paging nodes */ for ( var i=0, iLen=jqNodes.length ; iip>' } ); }, function () { var jqNodes = $('#demo div, #demo table'); var nNodes = []; var nCustomWrappers = [] /* Strip the paging nodes */ for ( var i=0, iLen=jqNodes.length ; i
    ', { 'valign': 'top', 'colSpan': _fnVisbleColumns( oSettings ), 'class': oSettings.oClasses.sRowEmpty } ).html( sZero ) )[0]; } /* Header and footer callbacks */ _fnCallbackFire( oSettings, 'aoHeaderCallback', 'header', [ $(oSettings.nTHead).children('tr')[0], _fnGetDataMaster( oSettings ), iDisplayStart, iDisplayEnd, aiDisplay ] ); _fnCallbackFire( oSettings, 'aoFooterCallback', 'footer', [ $(oSettings.nTFoot).children('tr')[0], _fnGetDataMaster( oSettings ), iDisplayStart, iDisplayEnd, aiDisplay ] ); var body = $(oSettings.nTBody); body.children().detach(); body.append( $(anRows) ); /* Call all required callback functions for the end of a draw */ _fnCallbackFire( oSettings, 'aoDrawCallback', 'draw', [oSettings] ); /* Draw is complete, sorting and filtering must be as well */ oSettings.bSorted = false; oSettings.bFiltered = false; oSettings.bDrawing = false; } /** * Redraw the table - taking account of the various features which are enabled * @param {object} oSettings dataTables settings object * @param {boolean} [holdPosition] Keep the current paging position. By default * the paging is reset to the first page * @memberof DataTable#oApi */ function _fnReDraw( settings, holdPosition ) { var features = settings.oFeatures, sort = features.bSort, filter = features.bFilter; if ( sort ) { _fnSort( settings ); } if ( filter ) { _fnFilterComplete( settings, settings.oPreviousSearch ); } else { // No filtering, so we want to just use the display master settings.aiDisplay = settings.aiDisplayMaster.slice(); } if ( holdPosition !== true ) { settings._iDisplayStart = 0; } // Let any modules know about the draw hold position state (used by // scrolling internally) settings._drawHold = holdPosition; _fnDraw( settings ); settings._drawHold = false; } /** * Add the options to the page HTML for the table * @param {object} oSettings dataTables settings object * @memberof DataTable#oApi */ function _fnAddOptionsHtml ( oSettings ) { var classes = oSettings.oClasses; var table = $(oSettings.nTable); var holding = $('
    ').insertBefore( table ); // Holding element for speed var features = oSettings.oFeatures; // All DataTables are wrapped in a div var insert = $('
    ', { id: oSettings.sTableId+'_wrapper', 'class': classes.sWrapper + (oSettings.nTFoot ? '' : ' '+classes.sNoFooter) } ); oSettings.nHolding = holding[0]; oSettings.nTableWrapper = insert[0]; oSettings.nTableReinsertBefore = oSettings.nTable.nextSibling; /* Loop over the user set positioning and place the elements as needed */ var aDom = oSettings.sDom.split(''); var featureNode, cOption, nNewNode, cNext, sAttr, j; for ( var i=0 ; i')[0]; /* Check to see if we should append an id and/or a class name to the container */ cNext = aDom[i+1]; if ( cNext == "'" || cNext == '"' ) { sAttr = ""; j = 2; while ( aDom[i+j] != cNext ) { sAttr += aDom[i+j]; j++; } /* Replace jQuery UI constants @todo depreciated */ if ( sAttr == "H" ) { sAttr = classes.sJUIHeader; } else if ( sAttr == "F" ) { sAttr = classes.sJUIFooter; } /* The attribute can be in the format of "#id.class", "#id" or "class" This logic * breaks the string into parts and applies them as needed */ if ( sAttr.indexOf('.') != -1 ) { var aSplit = sAttr.split('.'); nNewNode.id = aSplit[0].substr(1, aSplit[0].length-1); nNewNode.className = aSplit[1]; } else if ( sAttr.charAt(0) == "#" ) { nNewNode.id = sAttr.substr(1, sAttr.length-1); } else { nNewNode.className = sAttr; } i += j; /* Move along the position array */ } insert.append( nNewNode ); insert = $(nNewNode); } else if ( cOption == '>' ) { /* End container div */ insert = insert.parent(); } // @todo Move options into their own plugins? else if ( cOption == 'l' && features.bPaginate && features.bLengthChange ) { /* Length */ featureNode = _fnFeatureHtmlLength( oSettings ); } else if ( cOption == 'f' && features.bFilter ) { /* Filter */ featureNode = _fnFeatureHtmlFilter( oSettings ); } else if ( cOption == 'r' && features.bProcessing ) { /* pRocessing */ featureNode = _fnFeatureHtmlProcessing( oSettings ); } else if ( cOption == 't' ) { /* Table */ featureNode = _fnFeatureHtmlTable( oSettings ); } else if ( cOption == 'i' && features.bInfo ) { /* Info */ featureNode = _fnFeatureHtmlInfo( oSettings ); } else if ( cOption == 'p' && features.bPaginate ) { /* Pagination */ featureNode = _fnFeatureHtmlPaginate( oSettings ); } else if ( DataTable.ext.feature.length !== 0 ) { /* Plug-in features */ var aoFeatures = DataTable.ext.feature; for ( var k=0, kLen=aoFeatures.length ; k'; var str = language.sSearch; str = str.match(/_INPUT_/) ? str.replace('_INPUT_', input) : str+input; var filter = $('
    ', { 'id': ! features.f ? tableId+'_filter' : null, 'class': classes.sFilter } ) .append( $('
    ').html( _fnGetCellData( settings, idx, colIdx, 'display' ) )[0] : data.anCells[ colIdx ]; } /** * Get the maximum strlen for each data column * @param {object} settings dataTables settings object * @param {int} colIdx column of interest * @returns {string} max string length for each column * @memberof DataTable#oApi */ function _fnGetMaxLenString( settings, colIdx ) { var s, max=-1, maxIdx = -1; for ( var i=0, ien=settings.aoData.length ; i max ) { max = s.length; maxIdx = i; } } return maxIdx; } /** * Append a CSS unit (only if required) to a string * @param {string} value to css-ify * @returns {string} value with css unit * @memberof DataTable#oApi */ function _fnStringToCss( s ) { if ( s === null ) { return '0px'; } if ( typeof s == 'number' ) { return s < 0 ? '0px' : s+'px'; } // Check it has a unit character already return s.match(/\d$/) ? s+'px' : s; } DataTablesSrc-1.10.11/js/core/core.sort.js000066400000000000000000000272061265711500300201560ustar00rootroot00000000000000 function _fnSortFlatten ( settings ) { var i, iLen, k, kLen, aSort = [], aiOrig = [], aoColumns = settings.aoColumns, aDataSort, iCol, sType, srcCol, fixed = settings.aaSortingFixed, fixedObj = $.isPlainObject( fixed ), nestedSort = [], add = function ( a ) { if ( a.length && ! $.isArray( a[0] ) ) { // 1D array nestedSort.push( a ); } else { // 2D array $.merge( nestedSort, a ); } }; // Build the sort array, with pre-fix and post-fix options if they have been // specified if ( $.isArray( fixed ) ) { add( fixed ); } if ( fixedObj && fixed.pre ) { add( fixed.pre ); } add( settings.aaSorting ); if (fixedObj && fixed.post ) { add( fixed.post ); } for ( i=0 ; iy ? 1 : 0; if ( test !== 0 ) { return sort.dir === 'asc' ? test : -test; } } x = aiOrig[a]; y = aiOrig[b]; return xy ? 1 : 0; } ); } else { // Depreciated - remove in 1.11 (providing a plug-in option) // Not all sort types have formatting methods, so we have to call their sorting // methods. displayMaster.sort( function ( a, b ) { var x, y, k, l, test, sort, fn, len=aSort.length, dataA = aoData[a]._aSortData, dataB = aoData[b]._aSortData; for ( k=0 ; ky ? 1 : 0; } ); } } /* Tell the draw function that we have sorted the data */ oSettings.bSorted = true; } function _fnSortAria ( settings ) { var label; var nextSort; var columns = settings.aoColumns; var aSort = _fnSortFlatten( settings ); var oAria = settings.oLanguage.oAria; // ARIA attributes - need to loop all columns, to update all (removing old // attributes as needed) for ( var i=0, iLen=columns.length ; i/g, "" ); var th = col.nTh; // IE7 is throwing an error when setting these properties with jQuery's // attr() and removeAttr() methods... th.removeAttribute('aria-sort'); /* In ARIA only the first sorting column can be marked as sorting - no multi-sort option */ if ( col.bSortable ) { if ( aSort.length > 0 && aSort[0].col == i ) { th.setAttribute('aria-sort', aSort[0].dir=="asc" ? "ascending" : "descending" ); nextSort = asSorting[ aSort[0].index+1 ] || asSorting[0]; } else { nextSort = asSorting[0]; } label = sTitle + ( nextSort === "asc" ? oAria.sSortAscending : oAria.sSortDescending ); } else { label = sTitle; } th.setAttribute('aria-label', label); } } /** * Function to run on user sort request * @param {object} settings dataTables settings object * @param {node} attachTo node to attach the handler to * @param {int} colIdx column sorting index * @param {boolean} [append=false] Append the requested sort to the existing * sort if true (i.e. multi-column sort) * @param {function} [callback] callback function * @memberof DataTable#oApi */ function _fnSortListener ( settings, colIdx, append, callback ) { var col = settings.aoColumns[ colIdx ]; var sorting = settings.aaSorting; var asSorting = col.asSorting; var nextSortIdx; var next = function ( a, overflow ) { var idx = a._idx; if ( idx === undefined ) { idx = $.inArray( a[1], asSorting ); } return idx+1 < asSorting.length ? idx+1 : overflow ? null : 0; }; // Convert to 2D array if needed if ( typeof sorting[0] === 'number' ) { sorting = settings.aaSorting = [ sorting ]; } // If appending the sort then we are multi-column sorting if ( append && settings.oFeatures.bSortMulti ) { // Are we already doing some kind of sort on this column? var sortIdx = $.inArray( colIdx, _pluck(sorting, '0') ); if ( sortIdx !== -1 ) { // Yes, modify the sort nextSortIdx = next( sorting[sortIdx], true ); if ( nextSortIdx === null && sorting.length === 1 ) { nextSortIdx = 0; // can't remove sorting completely } if ( nextSortIdx === null ) { sorting.splice( sortIdx, 1 ); } else { sorting[sortIdx][1] = asSorting[ nextSortIdx ]; sorting[sortIdx]._idx = nextSortIdx; } } else { // No sort on this column yet sorting.push( [ colIdx, asSorting[0], 0 ] ); sorting[sorting.length-1]._idx = 0; } } else if ( sorting.length && sorting[0][0] == colIdx ) { // Single column - already sorting on this column, modify the sort nextSortIdx = next( sorting[0] ); sorting.length = 1; sorting[0][1] = asSorting[ nextSortIdx ]; sorting[0]._idx = nextSortIdx; } else { // Single column - sort only on this column sorting.length = 0; sorting.push( [ colIdx, asSorting[0] ] ); sorting[0]._idx = 0; } // Run the sort by calling a full redraw _fnReDraw( settings ); // callback used for async user interaction if ( typeof callback == 'function' ) { callback( settings ); } } /** * Attach a sort handler (click) to a node * @param {object} settings dataTables settings object * @param {node} attachTo node to attach the handler to * @param {int} colIdx column sorting index * @param {function} [callback] callback function * @memberof DataTable#oApi */ function _fnSortAttachListener ( settings, attachTo, colIdx, callback ) { var col = settings.aoColumns[ colIdx ]; _fnBindAction( attachTo, {}, function (e) { /* If the column is not sortable - don't to anything */ if ( col.bSortable === false ) { return; } // If processing is enabled use a timeout to allow the processing // display to be shown - otherwise to it synchronously if ( settings.oFeatures.bProcessing ) { _fnProcessingDisplay( settings, true ); setTimeout( function() { _fnSortListener( settings, colIdx, e.shiftKey, callback ); // In server-side processing, the draw callback will remove the // processing display if ( _fnDataSource( settings ) !== 'ssp' ) { _fnProcessingDisplay( settings, false ); } }, 0 ); } else { _fnSortListener( settings, colIdx, e.shiftKey, callback ); } } ); } /** * Set the sorting classes on table's body, Note: it is safe to call this function * when bSort and bSortClasses are false * @param {object} oSettings dataTables settings object * @memberof DataTable#oApi */ function _fnSortingClasses( settings ) { var oldSort = settings.aLastSort; var sortClass = settings.oClasses.sSortColumn; var sort = _fnSortFlatten( settings ); var features = settings.oFeatures; var i, ien, colIdx; if ( features.bSort && features.bSortClasses ) { // Remove old sorting classes for ( i=0, ien=oldSort.length ; i 0 && state.time < +new Date() - (duration*1000) ) { return; } // Number of columns have changed - all bets are off, no restore of settings if ( columns.length !== state.columns.length ) { return; } // Store the saved state so it might be accessed at any time settings.oLoadedState = $.extend( true, {}, state ); // Restore key features - todo - for 1.11 this needs to be done by // subscribed events if ( state.start !== undefined ) { settings._iDisplayStart = state.start; settings.iInitDisplayStart = state.start; } if ( state.length !== undefined ) { settings._iDisplayLength = state.length; } // Order if ( state.order !== undefined ) { settings.aaSorting = []; $.each( state.order, function ( i, col ) { settings.aaSorting.push( col[0] >= columns.length ? [ 0, col[1] ] : col ); } ); } // Search if ( state.search !== undefined ) { $.extend( settings.oPreviousSearch, _fnSearchToHung( state.search ) ); } // Columns for ( i=0, ien=state.columns.length ; i= end ) { start = end - len; } // Keep the start record on the current page start -= (start % len); if ( len === -1 || start < 0 ) { start = 0; } settings._iDisplayStart = start; } function _fnRenderer( settings, type ) { var renderer = settings.renderer; var host = DataTable.ext.renderer[type]; if ( $.isPlainObject( renderer ) && renderer[type] ) { // Specific renderer for this type. If available use it, otherwise use // the default. return host[renderer[type]] || host._; } else if ( typeof renderer === 'string' ) { // Common renderer - if there is one available for this type use it, // otherwise use the default return host[renderer] || host._; } // Use the default return host._; } /** * Detect the data source being used for the table. Used to simplify the code * a little (ajax) and to make it compress a little smaller. * * @param {object} settings dataTables settings object * @returns {string} Data source * @memberof DataTable#oApi */ function _fnDataSource ( settings ) { if ( settings.oFeatures.bServerSide ) { return 'ssp'; } else if ( settings.ajax || settings.sAjaxSource ) { return 'ajax'; } return 'dom'; } DataTablesSrc-1.10.11/js/ext/000077500000000000000000000000001265711500300155435ustar00rootroot00000000000000DataTablesSrc-1.10.11/js/ext/ext.classes.js000066400000000000000000000067611265711500300203470ustar00rootroot00000000000000 $.extend( DataTable.ext.classes, { "sTable": "dataTable", "sNoFooter": "no-footer", /* Paging buttons */ "sPageButton": "paginate_button", "sPageButtonActive": "current", "sPageButtonDisabled": "disabled", /* Striping classes */ "sStripeOdd": "odd", "sStripeEven": "even", /* Empty row */ "sRowEmpty": "dataTables_empty", /* Features */ "sWrapper": "dataTables_wrapper", "sFilter": "dataTables_filter", "sInfo": "dataTables_info", "sPaging": "dataTables_paginate paging_", /* Note that the type is postfixed */ "sLength": "dataTables_length", "sProcessing": "dataTables_processing", /* Sorting */ "sSortAsc": "sorting_asc", "sSortDesc": "sorting_desc", "sSortable": "sorting", /* Sortable in both directions */ "sSortableAsc": "sorting_asc_disabled", "sSortableDesc": "sorting_desc_disabled", "sSortableNone": "sorting_disabled", "sSortColumn": "sorting_", /* Note that an int is postfixed for the sorting order */ /* Filtering */ "sFilterInput": "", /* Page length */ "sLengthSelect": "", /* Scrolling */ "sScrollWrapper": "dataTables_scroll", "sScrollHead": "dataTables_scrollHead", "sScrollHeadInner": "dataTables_scrollHeadInner", "sScrollBody": "dataTables_scrollBody", "sScrollFoot": "dataTables_scrollFoot", "sScrollFootInner": "dataTables_scrollFootInner", /* Misc */ "sHeaderTH": "", "sFooterTH": "", // Deprecated "sSortJUIAsc": "", "sSortJUIDesc": "", "sSortJUI": "", "sSortJUIAscAllowed": "", "sSortJUIDescAllowed": "", "sSortJUIWrapper": "", "sSortIcon": "", "sJUIHeader": "", "sJUIFooter": "" } ); (function() { // Reused strings for better compression. Closure compiler appears to have a // weird edge case where it is trying to expand strings rather than use the // variable version. This results in about 200 bytes being added, for very // little preference benefit since it this run on script load only. var _empty = ''; _empty = ''; var _stateDefault = _empty + 'ui-state-default'; var _sortIcon = _empty + 'css_right ui-icon ui-icon-'; var _headerFooter = _empty + 'fg-toolbar ui-toolbar ui-widget-header ui-helper-clearfix'; $.extend( DataTable.ext.oJUIClasses, DataTable.ext.classes, { /* Full numbers paging buttons */ "sPageButton": "fg-button ui-button "+_stateDefault, "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": _stateDefault+" sorting_asc", "sSortDesc": _stateDefault+" sorting_desc", "sSortable": _stateDefault+" sorting", "sSortableAsc": _stateDefault+" sorting_asc_disabled", "sSortableDesc": _stateDefault+" sorting_desc_disabled", "sSortableNone": _stateDefault+" sorting_disabled", "sSortJUIAsc": _sortIcon+"triangle-1-n", "sSortJUIDesc": _sortIcon+"triangle-1-s", "sSortJUI": _sortIcon+"carat-2-n-s", "sSortJUIAscAllowed": _sortIcon+"carat-1-n", "sSortJUIDescAllowed": _sortIcon+"carat-1-s", "sSortJUIWrapper": "DataTables_sort_wrapper", "sSortIcon": "DataTables_sort_icon", /* Scrolling */ "sScrollHead": "dataTables_scrollHead "+_stateDefault, "sScrollFoot": "dataTables_scrollFoot "+_stateDefault, /* Misc */ "sHeaderTH": _stateDefault, "sFooterTH": _stateDefault, "sJUIHeader": _headerFooter+" ui-corner-tl ui-corner-tr", "sJUIFooter": _headerFooter+" ui-corner-bl ui-corner-br" } ); }()); DataTablesSrc-1.10.11/js/ext/ext.filter.js000066400000000000000000000012301265711500300201610ustar00rootroot00000000000000 // Filter formatting functions. See model.ext.ofnSearch for information about // what is required from these methods. // // Note that additional search methods are added for the html numbers and // html formatted numbers by `_addNumericSort()` when we know what the decimal // place is $.extend( DataTable.ext.type.search, { html: function ( data ) { return _empty(data) ? data : typeof data === 'string' ? data .replace( _re_new_lines, " " ) .replace( _re_html, "" ) : ''; }, string: function ( data ) { return _empty(data) ? data : typeof data === 'string' ? data.replace( _re_new_lines, " " ) : data; } } ); DataTablesSrc-1.10.11/js/ext/ext.helpers.js000066400000000000000000000043551265711500300203510ustar00rootroot00000000000000 /* * Public helper functions. These aren't used internally by DataTables, or * called by any of the options passed into DataTables, but they can be used * externally by developers working with DataTables. They are helper functions * to make working with DataTables a little bit easier. */ var __htmlEscapeEntities = function ( d ) { return typeof d === 'string' ? d.replace(//g, '>').replace(/"/g, '"') : d; }; /** * Helpers for `columns.render`. * * The options defined here can be used with the `columns.render` initialisation * option to provide a display renderer. The following functions are defined: * * * `number` - Will format numeric data (defined by `columns.data`) for * display, retaining the original unformatted data for sorting and filtering. * It takes 5 parameters: * * `string` - Thousands grouping separator * * `string` - Decimal point indicator * * `integer` - Number of decimal points to show * * `string` (optional) - Prefix. * * `string` (optional) - Postfix (/suffix). * * `text` - Escape HTML to help prevent XSS attacks. It has no optional * parameters. * * @example * // Column definition using the number renderer * { * data: "salary", * render: $.fn.dataTable.render.number( '\'', '.', 0, '$' ) * } * * @namespace */ DataTable.render = { number: function ( thousands, decimal, precision, prefix, postfix ) { return { display: function ( d ) { if ( typeof d !== 'number' && typeof d !== 'string' ) { return d; } var negative = d < 0 ? '-' : ''; var flo = parseFloat( d ); // If NaN then there isn't much formatting that we can do - just // return immediately, escaping any HTML (this was supposed to // be a number after all) if ( isNaN( flo ) ) { return __htmlEscapeEntities( d ); } d = Math.abs( flo ); var intPart = parseInt( d, 10 ); var floatPart = precision ? decimal+(d - intPart).toFixed( precision ).substring( 2 ): ''; return negative + (prefix||'') + intPart.toString().replace( /\B(?=(\d{3})+(?!\d))/g, thousands ) + floatPart + (postfix||''); } }; }, text: function () { return { display: __htmlEscapeEntities }; } }; DataTablesSrc-1.10.11/js/ext/ext.js000066400000000000000000000402101265711500300166760ustar00rootroot00000000000000 /** * DataTables extensions * * This namespace acts as a collection area for plug-ins that can be used to * extend DataTables capabilities. Indeed many of the build in methods * use this method to provide their own capabilities (sorting methods for * example). * * Note that this namespace is aliased to `jQuery.fn.dataTableExt` for legacy * reasons * * @namespace */ DataTable.ext = _ext = { /** * Buttons. For use with the Buttons extension for DataTables. This is * defined here so other extensions can define buttons regardless of load * order. It is _not_ used by DataTables core. * * @type object * @default {} */ buttons: {}, /** * Element class names * * @type object * @default {} */ classes: {}, /** * DataTables build type (expanded by the download builder) * * @type string */ builder: "-source-", /** * Error reporting. * * How should DataTables report an error. Can take the value 'alert', * 'throw', 'none' or a function. * * @type string|function * @default alert */ errMode: "alert", /** * Feature plug-ins. * * This is an array of objects which describe the feature plug-ins that are * available to DataTables. These feature plug-ins are then available for * use through the `dom` initialisation option. * * Each feature plug-in is described by an object which must have the * following properties: * * * `fnInit` - function that is used to initialise the plug-in, * * `cFeature` - a character so the feature can be enabled by the `dom` * instillation option. This is case sensitive. * * The `fnInit` function has the following input parameters: * * 1. `{object}` DataTables settings object: see * {@link DataTable.models.oSettings} * * And the following return is expected: * * * {node|null} The element which contains your feature. Note that the * return may also be void if your plug-in does not require to inject any * DOM elements into DataTables control (`dom`) - for example this might * be useful when developing a plug-in which allows table control via * keyboard entry * * @type array * * @example * $.fn.dataTable.ext.features.push( { * "fnInit": function( oSettings ) { * return new TableTools( { "oDTSettings": oSettings } ); * }, * "cFeature": "T" * } ); */ feature: [], /** * Row searching. * * This method of searching is complimentary to the default type based * searching, and a lot more comprehensive as it allows you complete control * over the searching logic. Each element in this array is a function * (parameters described below) that is called for every row in the table, * and your logic decides if it should be included in the searching data set * or not. * * Searching functions have the following input parameters: * * 1. `{object}` DataTables settings object: see * {@link DataTable.models.oSettings} * 2. `{array|object}` Data for the row to be processed (same as the * original format that was passed in as the data source, or an array * from a DOM data source * 3. `{int}` Row index ({@link DataTable.models.oSettings.aoData}), which * can be useful to retrieve the `TR` element if you need DOM interaction. * * And the following return is expected: * * * {boolean} Include the row in the searched result set (true) or not * (false) * * Note that as with the main search ability in DataTables, technically this * is "filtering", since it is subtractive. However, for consistency in * naming we call it searching here. * * @type array * @default [] * * @example * // The following example shows custom search being applied to the * // fourth column (i.e. the data[3] index) based on two input values * // from the end-user, matching the data in a certain range. * $.fn.dataTable.ext.search.push( * function( settings, data, dataIndex ) { * var min = document.getElementById('min').value * 1; * var max = document.getElementById('max').value * 1; * var version = data[3] == "-" ? 0 : data[3]*1; * * if ( min == "" && max == "" ) { * return true; * } * else if ( min == "" && version < max ) { * return true; * } * else if ( min < version && "" == max ) { * return true; * } * else if ( min < version && version < max ) { * return true; * } * return false; * } * ); */ search: [], /** * Selector extensions * * The `selector` option can be used to extend the options available for the * selector modifier options (`selector-modifier` object data type) that * each of the three built in selector types offer (row, column and cell + * their plural counterparts). For example the Select extension uses this * mechanism to provide an option to select only rows, columns and cells * that have been marked as selected by the end user (`{selected: true}`), * which can be used in conjunction with the existing built in selector * options. * * Each property is an array to which functions can be pushed. The functions * take three attributes: * * * Settings object for the host table * * Options object (`selector-modifier` object type) * * Array of selected item indexes * * The return is an array of the resulting item indexes after the custom * selector has been applied. * * @type object */ selector: { cell: [], column: [], row: [] }, /** * Internal functions, exposed for used in plug-ins. * * Please note that you should not need to use the internal methods for * anything other than a plug-in (and even then, try to avoid if possible). * The internal function may change between releases. * * @type object * @default {} */ internal: {}, /** * Legacy configuration options. Enable and disable legacy options that * are available in DataTables. * * @type object */ legacy: { /** * Enable / disable DataTables 1.9 compatible server-side processing * requests * * @type boolean * @default null */ ajax: null }, /** * Pagination plug-in methods. * * Each entry in this object is a function and defines which buttons should * be shown by the pagination rendering method that is used for the table: * {@link DataTable.ext.renderer.pageButton}. The renderer addresses how the * buttons are displayed in the document, while the functions here tell it * what buttons to display. This is done by returning an array of button * descriptions (what each button will do). * * Pagination types (the four built in options and any additional plug-in * options defined here) can be used through the `paginationType` * initialisation parameter. * * The functions defined take two parameters: * * 1. `{int} page` The current page index * 2. `{int} pages` The number of pages in the table * * Each function is expected to return an array where each element of the * array can be one of: * * * `first` - Jump to first page when activated * * `last` - Jump to last page when activated * * `previous` - Show previous page when activated * * `next` - Show next page when activated * * `{int}` - Show page of the index given * * `{array}` - A nested array containing the above elements to add a * containing 'DIV' element (might be useful for styling). * * Note that DataTables v1.9- used this object slightly differently whereby * an object with two functions would be defined for each plug-in. That * ability is still supported by DataTables 1.10+ to provide backwards * compatibility, but this option of use is now decremented and no longer * documented in DataTables 1.10+. * * @type object * @default {} * * @example * // Show previous, next and current page buttons only * $.fn.dataTableExt.oPagination.current = function ( page, pages ) { * return [ 'previous', page, 'next' ]; * }; */ pager: {}, renderer: { pageButton: {}, header: {} }, /** * Ordering plug-ins - custom data source * * The extension options for ordering of data available here is complimentary * to the default type based ordering that DataTables typically uses. It * allows much greater control over the the data that is being used to * order a column, but is necessarily therefore more complex. * * This type of ordering is useful if you want to do ordering based on data * live from the DOM (for example the contents of an 'input' element) rather * than just the static string that DataTables knows of. * * The way these plug-ins work is that you create an array of the values you * wish to be ordering for the column in question and then return that * array. The data in the array much be in the index order of the rows in * the table (not the currently ordering order!). Which order data gathering * function is run here depends on the `dt-init columns.orderDataType` * parameter that is used for the column (if any). * * The functions defined take two parameters: * * 1. `{object}` DataTables settings object: see * {@link DataTable.models.oSettings} * 2. `{int}` Target column index * * Each function is expected to return an array: * * * `{array}` Data for the column to be ordering upon * * @type array * * @example * // Ordering using `input` node values * $.fn.dataTable.ext.order['dom-text'] = function ( settings, col ) * { * return this.api().column( col, {order:'index'} ).nodes().map( function ( td, i ) { * return $('input', td).val(); * } ); * } */ order: {}, /** * Type based plug-ins. * * Each column in DataTables has a type assigned to it, either by automatic * detection or by direct assignment using the `type` option for the column. * The type of a column will effect how it is ordering and search (plug-ins * can also make use of the column type if required). * * @namespace */ type: { /** * Type detection functions. * * The functions defined in this object are used to automatically detect * a column's type, making initialisation of DataTables super easy, even * when complex data is in the table. * * The functions defined take two parameters: * * 1. `{*}` Data from the column cell to be analysed * 2. `{settings}` DataTables settings object. This can be used to * perform context specific type detection - for example detection * based on language settings such as using a comma for a decimal * place. Generally speaking the options from the settings will not * be required * * Each function is expected to return: * * * `{string|null}` Data type detected, or null if unknown (and thus * pass it on to the other type detection functions. * * @type array * * @example * // Currency type detection plug-in: * $.fn.dataTable.ext.type.detect.push( * function ( data, settings ) { * // Check the numeric part * if ( ! $.isNumeric( data.substring(1) ) ) { * return null; * } * * // Check prefixed by currency * if ( data.charAt(0) == '$' || data.charAt(0) == '£' ) { * return 'currency'; * } * return null; * } * ); */ detect: [], /** * Type based search formatting. * * The type based searching functions can be used to pre-format the * data to be search on. For example, it can be used to strip HTML * tags or to de-format telephone numbers for numeric only searching. * * Note that is a search is not defined for a column of a given type, * no search formatting will be performed. * * Pre-processing of searching data plug-ins - When you assign the sType * for a column (or have it automatically detected for you by DataTables * or a type detection plug-in), you will typically be using this for * custom sorting, but it can also be used to provide custom searching * by allowing you to pre-processing the data and returning the data in * the format that should be searched upon. This is done by adding * functions this object with a parameter name which matches the sType * for that target column. This is the corollary of afnSortData * for searching data. * * The functions defined take a single parameter: * * 1. `{*}` Data from the column cell to be prepared for searching * * Each function is expected to return: * * * `{string|null}` Formatted string that will be used for the searching. * * @type object * @default {} * * @example * $.fn.dataTable.ext.type.search['title-numeric'] = function ( d ) { * return d.replace(/\n/g," ").replace( /<.*?>/g, "" ); * } */ search: {}, /** * Type based ordering. * * The column type tells DataTables what ordering to apply to the table * when a column is sorted upon. The order for each type that is defined, * is defined by the functions available in this object. * * Each ordering option can be described by three properties added to * this object: * * * `{type}-pre` - Pre-formatting function * * `{type}-asc` - Ascending order function * * `{type}-desc` - Descending order function * * All three can be used together, only `{type}-pre` or only * `{type}-asc` and `{type}-desc` together. It is generally recommended * that only `{type}-pre` is used, as this provides the optimal * implementation in terms of speed, although the others are provided * for compatibility with existing Javascript sort functions. * * `{type}-pre`: Functions defined take a single parameter: * * 1. `{*}` Data from the column cell to be prepared for ordering * * And return: * * * `{*}` Data to be sorted upon * * `{type}-asc` and `{type}-desc`: Functions are typical Javascript sort * functions, taking two parameters: * * 1. `{*}` Data to compare to the second parameter * 2. `{*}` Data to compare to the first parameter * * And returning: * * * `{*}` Ordering match: <0 if first parameter should be sorted lower * than the second parameter, ===0 if the two parameters are equal and * >0 if the first parameter should be sorted height than the second * parameter. * * @type object * @default {} * * @example * // Numeric ordering of formatted numbers with a pre-formatter * $.extend( $.fn.dataTable.ext.type.order, { * "string-pre": function(x) { * a = (a === "-" || a === "") ? 0 : a.replace( /[^\d\-\.]/g, "" ); * return parseFloat( a ); * } * } ); * * @example * // Case-sensitive string ordering, with no pre-formatting method * $.extend( $.fn.dataTable.ext.order, { * "string-case-asc": function(x,y) { * return ((x < y) ? -1 : ((x > y) ? 1 : 0)); * }, * "string-case-desc": function(x,y) { * return ((x < y) ? 1 : ((x > y) ? -1 : 0)); * } * } ); */ order: {} }, /** * Unique DataTables instance counter * * @type int * @private */ _unique: 0, // // Depreciated // The following properties are retained for backwards compatiblity only. // The should not be used in new projects and will be removed in a future // version // /** * Version check function. * @type function * @depreciated Since 1.10 */ fnVersionCheck: DataTable.fnVersionCheck, /** * Index for what 'this' index API functions should use * @type int * @deprecated Since v1.10 */ iApiIndex: 0, /** * jQuery UI class container * @type object * @deprecated Since v1.10 */ oJUIClasses: {}, /** * Software version * @type string * @deprecated Since v1.10 */ sVersion: DataTable.version }; // // Backwards compatibility. Alias to pre 1.10 Hungarian notation counter parts // $.extend( _ext, { afnFiltering: _ext.search, aTypes: _ext.type.detect, ofnSearch: _ext.type.search, oSort: _ext.type.order, afnSortData: _ext.order, aoFeatures: _ext.feature, oApi: _ext.internal, oStdClasses: _ext.classes, oPagination: _ext.pager } ); DataTablesSrc-1.10.11/js/ext/ext.paging.js000066400000000000000000000104421265711500300201460ustar00rootroot00000000000000 var extPagination = DataTable.ext.pager; function _numbers ( page, pages ) { var numbers = [], buttons = extPagination.numbers_length, half = Math.floor( buttons / 2 ), i = 1; if ( pages <= buttons ) { numbers = _range( 0, pages ); } else if ( page <= half ) { numbers = _range( 0, buttons-2 ); numbers.push( 'ellipsis' ); numbers.push( pages-1 ); } else if ( page >= pages - 1 - half ) { numbers = _range( pages-(buttons-2), pages ); numbers.splice( 0, 0, 'ellipsis' ); // no unshift in ie6 numbers.splice( 0, 0, 0 ); } else { numbers = _range( page-half+2, page+half-1 ); numbers.push( 'ellipsis' ); numbers.push( pages-1 ); numbers.splice( 0, 0, 'ellipsis' ); numbers.splice( 0, 0, 0 ); } numbers.DT_el = 'span'; return numbers; } $.extend( extPagination, { simple: function ( page, pages ) { return [ 'previous', 'next' ]; }, full: function ( page, pages ) { return [ 'first', 'previous', 'next', 'last' ]; }, numbers: function ( page, pages ) { return [ _numbers(page, pages) ]; }, simple_numbers: function ( page, pages ) { return [ 'previous', _numbers(page, pages), 'next' ]; }, full_numbers: function ( page, pages ) { return [ 'first', 'previous', _numbers(page, pages), 'next', 'last' ]; }, // For testing and plug-ins to use _numbers: _numbers, // Number of number buttons (including ellipsis) to show. _Must be odd!_ numbers_length: 7 } ); $.extend( true, DataTable.ext.renderer, { pageButton: { _: function ( settings, host, idx, buttons, page, pages ) { var classes = settings.oClasses; var lang = settings.oLanguage.oPaginate; var aria = settings.oLanguage.oAria.paginate || {}; var btnDisplay, btnClass, counter=0; var attach = function( container, buttons ) { var i, ien, node, button; var clickHandler = function ( e ) { _fnPageChange( settings, e.data.action, true ); }; for ( i=0, ien=buttons.length ; i' ) .appendTo( container ); attach( inner, button ); } else { btnDisplay = null; btnClass = ''; switch ( button ) { case 'ellipsis': container.append(''); break; case 'first': btnDisplay = lang.sFirst; btnClass = button + (page > 0 ? '' : ' '+classes.sPageButtonDisabled); break; case 'previous': btnDisplay = lang.sPrevious; btnClass = button + (page > 0 ? '' : ' '+classes.sPageButtonDisabled); break; case 'next': btnDisplay = lang.sNext; btnClass = button + (page < pages-1 ? '' : ' '+classes.sPageButtonDisabled); break; case 'last': btnDisplay = lang.sLast; btnClass = button + (page < pages-1 ? '' : ' '+classes.sPageButtonDisabled); break; default: btnDisplay = button + 1; btnClass = page === button ? classes.sPageButtonActive : ''; break; } if ( btnDisplay !== null ) { node = $('', { 'class': classes.sPageButton+' '+btnClass, 'aria-controls': settings.sTableId, 'aria-label': aria[ button ], 'data-dt-idx': counter, 'tabindex': settings.iTabIndex, 'id': idx === 0 && typeof button === 'string' ? settings.sTableId +'_'+ button : null } ) .html( btnDisplay ) .appendTo( container ); _fnBindAction( node, {action: button}, clickHandler ); counter++; } } } }; // IE9 throws an 'unknown error' if document.activeElement is used // inside an iframe or frame. Try / catch the error. Not good for // accessibility, but neither are frames. var activeEl; try { // Because this approach is destroying and recreating the paging // elements, focus is lost on the select button which is bad for // accessibility. So we want to restore focus once the draw has // completed activeEl = $(host).find(document.activeElement).data('dt-idx'); } catch (e) {} attach( $(host).empty(), buttons ); if ( activeEl ) { $(host).find( '[data-dt-idx='+activeEl+']' ).focus(); } } } } ); DataTablesSrc-1.10.11/js/ext/ext.renderer.js000066400000000000000000000040041265711500300205040ustar00rootroot00000000000000 $.extend( true, DataTable.ext.renderer, { header: { _: function ( settings, cell, column, classes ) { // No additional mark-up required // Attach a sort listener to update on sort - note that using the // `DT` namespace will allow the event to be removed automatically // on destroy, while the `dt` namespaced event is the one we are // listening for $(settings.nTable).on( 'order.dt.DT', function ( e, ctx, sorting, columns ) { if ( settings !== ctx ) { // need to check this this is the host return; // table, not a nested one } var colIdx = column.idx; cell .removeClass( column.sSortingClass +' '+ classes.sSortAsc +' '+ classes.sSortDesc ) .addClass( columns[ colIdx ] == 'asc' ? classes.sSortAsc : columns[ colIdx ] == 'desc' ? classes.sSortDesc : column.sSortingClass ); } ); }, jqueryui: function ( settings, cell, column, classes ) { $('
    ') .addClass( classes.sSortJUIWrapper ) .append( cell.contents() ) .append( $('') .addClass( classes.sSortIcon+' '+column.sSortingClassJUI ) ) .appendTo( cell ); // Attach a sort listener to update on sort $(settings.nTable).on( 'order.dt.DT', function ( e, ctx, sorting, columns ) { if ( settings !== ctx ) { return; } var colIdx = column.idx; cell .removeClass( classes.sSortAsc +" "+classes.sSortDesc ) .addClass( columns[ colIdx ] == 'asc' ? classes.sSortAsc : columns[ colIdx ] == 'desc' ? classes.sSortDesc : column.sSortingClass ); cell .find( 'span.'+classes.sSortIcon ) .removeClass( classes.sSortJUIAsc +" "+ classes.sSortJUIDesc +" "+ classes.sSortJUI +" "+ classes.sSortJUIAscAllowed +" "+ classes.sSortJUIDescAllowed ) .addClass( columns[ colIdx ] == 'asc' ? classes.sSortJUIAsc : columns[ colIdx ] == 'desc' ? classes.sSortJUIDesc : column.sSortingClassJUI ); } ); } } } ); DataTablesSrc-1.10.11/js/ext/ext.sorting.js000066400000000000000000000047421265711500300203740ustar00rootroot00000000000000 var __numericReplace = function ( d, decimalPlace, re1, re2 ) { if ( d !== 0 && (!d || d === '-') ) { return -Infinity; } // If a decimal place other than `.` is used, it needs to be given to the // function so we can detect it and replace with a `.` which is the only // decimal place Javascript recognises - it is not locale aware. if ( decimalPlace ) { d = _numToDecimal( d, decimalPlace ); } if ( d.replace ) { if ( re1 ) { d = d.replace( re1, '' ); } if ( re2 ) { d = d.replace( re2, '' ); } } return d * 1; }; // Add the numeric 'deformatting' functions for sorting and search. This is done // in a function to provide an easy ability for the language options to add // additional methods if a non-period decimal place is used. function _addNumericSort ( decimalPlace ) { $.each( { // Plain numbers "num": function ( d ) { return __numericReplace( d, decimalPlace ); }, // Formatted numbers "num-fmt": function ( d ) { return __numericReplace( d, decimalPlace, _re_formatted_numeric ); }, // HTML numeric "html-num": function ( d ) { return __numericReplace( d, decimalPlace, _re_html ); }, // HTML numeric, formatted "html-num-fmt": function ( d ) { return __numericReplace( d, decimalPlace, _re_html, _re_formatted_numeric ); } }, function ( key, fn ) { // Add the ordering method _ext.type.order[ key+decimalPlace+'-pre' ] = fn; // For HTML types add a search formatter that will strip the HTML if ( key.match(/^html\-/) ) { _ext.type.search[ key+decimalPlace ] = _ext.type.search.html; } } ); } // Default sort methods $.extend( _ext.type.order, { // Dates "date-pre": function ( d ) { return Date.parse( d ) || 0; }, // html "html-pre": function ( a ) { return _empty(a) ? '' : a.replace ? a.replace( /<.*?>/g, "" ).toLowerCase() : a+''; }, // string "string-pre": function ( a ) { // This is a little complex, but faster than always calling toString, // http://jsperf.com/tostring-v-check return _empty(a) ? '' : typeof a === 'string' ? a.toLowerCase() : ! a.toString ? '' : a.toString(); }, // string-asc and -desc are retained only for compatibility with the old // sort methods "string-asc": function ( x, y ) { return ((x < y) ? -1 : ((x > y) ? 1 : 0)); }, "string-desc": function ( x, y ) { return ((x < y) ? 1 : ((x > y) ? -1 : 0)); } } ); // Numeric sorting types - order doesn't matter here _addNumericSort( '' ); DataTablesSrc-1.10.11/js/ext/ext.types.js000066400000000000000000000031471265711500300200510ustar00rootroot00000000000000 // Built in type detection. See model.ext.aTypes for information about // what is required from this methods. $.extend( DataTable.ext.type.detect, [ // Plain numbers - first since V8 detects some plain numbers as dates // e.g. Date.parse('55') (but not all, e.g. Date.parse('22')...). function ( d, settings ) { var decimal = settings.oLanguage.sDecimal; return _isNumber( d, decimal ) ? 'num'+decimal : null; }, // Dates (only those recognised by the browser's Date.parse) function ( d, settings ) { // V8 will remove any unknown characters at the start and end of the // expression, leading to false matches such as `$245.12` or `10%` being // a valid date. See forum thread 18941 for detail. if ( d && !(d instanceof Date) && ( ! _re_date_start.test(d) || ! _re_date_end.test(d) ) ) { return null; } var parsed = Date.parse(d); return (parsed !== null && !isNaN(parsed)) || _empty(d) ? 'date' : null; }, // Formatted numbers function ( d, settings ) { var decimal = settings.oLanguage.sDecimal; return _isNumber( d, decimal, true ) ? 'num-fmt'+decimal : null; }, // HTML numeric function ( d, settings ) { var decimal = settings.oLanguage.sDecimal; return _htmlNumeric( d, decimal ) ? 'html-num'+decimal : null; }, // HTML numeric, formatted function ( d, settings ) { var decimal = settings.oLanguage.sDecimal; return _htmlNumeric( d, decimal, true ) ? 'html-num-fmt'+decimal : null; }, // HTML (this is strict checking - there must be html) function ( d, settings ) { return _empty( d ) || (typeof d === 'string' && d.indexOf('<') !== -1) ? 'html' : null; } ] ); DataTablesSrc-1.10.11/js/integration/000077500000000000000000000000001265711500300172665ustar00rootroot00000000000000DataTablesSrc-1.10.11/js/integration/dataTables.bootstrap.js000066400000000000000000000107001265711500300237020ustar00rootroot00000000000000/*! DataTables Bootstrap 3 integration * ©2011-2015 SpryMedia Ltd - datatables.net/license */ /** * DataTables integration for Bootstrap 3. This requires Bootstrap 3 and * DataTables 1.10 or newer. * * This file sets the defaults and adds options to DataTables to style its * controls using Bootstrap. See http://datatables.net/manual/styling/bootstrap * for further information. */ (function( factory ){ if ( typeof define === 'function' && define.amd ) { // AMD define( ['jquery', 'datatables.net'], function ( $ ) { return factory( $, window, document ); } ); } else if ( typeof exports === 'object' ) { // CommonJS module.exports = function (root, $) { if ( ! root ) { root = window; } if ( ! $ || ! $.fn.dataTable ) { // Require DataTables, which attaches to jQuery, including // jQuery if needed and have a $ property so we can access the // jQuery object that is used $ = require('datatables.net')(root, $).$; } return factory( $, root, root.document ); }; } else { // Browser factory( jQuery, window, document ); } }(function( $, window, document, undefined ) { 'use strict'; var DataTable = $.fn.dataTable; /* Set the defaults for DataTables initialisation */ $.extend( true, DataTable.defaults, { dom: "<'row'<'col-sm-6'l><'col-sm-6'f>>" + "<'row'<'col-sm-12'tr>>" + "<'row'<'col-sm-5'i><'col-sm-7'p>>", renderer: 'bootstrap' } ); /* Default class modification */ $.extend( DataTable.ext.classes, { sWrapper: "dataTables_wrapper form-inline dt-bootstrap", sFilterInput: "form-control input-sm", sLengthSelect: "form-control input-sm", sProcessing: "dataTables_processing panel panel-default" } ); /* Bootstrap paging button renderer */ DataTable.ext.renderer.pageButton.bootstrap = function ( settings, host, idx, buttons, page, pages ) { var api = new DataTable.Api( settings ); var classes = settings.oClasses; var lang = settings.oLanguage.oPaginate; var aria = settings.oLanguage.oAria.paginate || {}; var btnDisplay, btnClass, counter=0; var attach = function( container, buttons ) { var i, ien, node, button; var clickHandler = function ( e ) { e.preventDefault(); if ( !$(e.currentTarget).hasClass('disabled') && api.page() != e.data.action ) { api.page( e.data.action ).draw( 'page' ); } }; for ( i=0, ien=buttons.length ; i 0 ? '' : ' disabled'); break; case 'previous': btnDisplay = lang.sPrevious; btnClass = button + (page > 0 ? '' : ' disabled'); break; case 'next': btnDisplay = lang.sNext; btnClass = button + (page < pages-1 ? '' : ' disabled'); break; case 'last': btnDisplay = lang.sLast; btnClass = button + (page < pages-1 ? '' : ' disabled'); break; default: btnDisplay = button + 1; btnClass = page === button ? 'active' : ''; break; } if ( btnDisplay ) { node = $('
  • ', { 'class': classes.sPageButton+' '+btnClass, 'id': idx === 0 && typeof button === 'string' ? settings.sTableId +'_'+ button : null } ) .append( $('', { 'href': '#', 'aria-controls': settings.sTableId, 'aria-label': aria[ button ], 'data-dt-idx': counter, 'tabindex': settings.iTabIndex } ) .html( btnDisplay ) ) .appendTo( container ); settings.oApi._fnBindAction( node, {action: button}, clickHandler ); counter++; } } } }; // IE9 throws an 'unknown error' if document.activeElement is used // inside an iframe or frame. var activeEl; try { // Because this approach is destroying and recreating the paging // elements, focus is lost on the select button which is bad for // accessibility. So we want to restore focus once the draw has // completed activeEl = $(host).find(document.activeElement).data('dt-idx'); } catch (e) {} attach( $(host).empty().html('
  • 678910678910