### Create and Initialize DataTable Source: https://github.com/datatables/datatablessrc/blob/master/test/performance/common.txt This snippet initializes a DataTable with a large dataset. Ensure the DOM element with id 'example' exists and DataTables library is included. ```javascript let table; let columns = 30; let rows = 2500; let runs = 15; it('Create the table', function() { let header = ''; for (let i = 0; i < columns; i++) { header += '' + i + ''; } $('#example').append('' + header + ''); let data = []; for (let i = 0; i < rows; i++) { let line = []; for (j = 0; j < columns; j++) { line.push(i + '-' + j); } data.push(line); } table = $('#example').DataTable({ data: data }); expect(table.page.info().recordsTotal).toBe(rows); }); ``` -------------------------------- ### Basic JavaScript Initialization Source: https://github.com/datatables/datatablessrc/blob/master/build/templates/example.html The core JavaScript code used to initialize the DataTables instance for the example. ```javascript {js-esc} ``` -------------------------------- ### Clone and Build DataTables Source Source: https://github.com/datatables/datatablessrc/blob/master/Readme.md Clone the DataTables source repository, install dependencies, and build the project for local development. ```bash git clone https://github.com/DataTables/DataTablesSrc.git cd DataTablesSrc npm install npm run build-debug npm serve ``` -------------------------------- ### Initialize DataTables with Libraries Source: https://github.com/datatables/datatablessrc/blob/master/build/templates/example.html This snippet shows the basic initialization of DataTables, specifying libraries and a run function for custom JavaScript logic. ```javascript dt_demo.init({ libs: {libs}, run: function () { {js} } }); ``` -------------------------------- ### Load DataTables Libraries and CSS Source: https://github.com/datatables/datatablessrc/blob/master/test/performance/current.txt Loads the necessary jQuery, DataTables JavaScript, and CSS files for testing. Ensure these are available in your project. ```javascript dt.libs({ js: ['jquery', 'datatables'], css: ['datatables'] }); ``` -------------------------------- ### Check DataTables Version Source: https://github.com/datatables/datatablessrc/blob/master/test/performance/old.txt Asserts that the loaded DataTables version is '2.1.0'. This is useful for ensuring the correct library version is being tested. ```javascript describe('performance', function() { dt.libs({ js: ['jquery', 'datatables210'], css: ['datatables210'] }); dt.html('empty_no_header'); it('Check this is the old version', function() { expect($.fn.dataTable.version).toBe('2.1.0'); }); }); ``` -------------------------------- ### Generate Empty HTML for Testing Source: https://github.com/datatables/datatablessrc/blob/master/test/performance/current.txt Generates an empty HTML structure for DataTables, specifically without a header, to facilitate testing scenarios. ```javascript dt.html('empty_no_header'); ``` -------------------------------- ### Additional CSS for Table Styling Source: https://github.com/datatables/datatablessrc/blob/master/build/templates/example.html Custom CSS rules applied to enhance the table's appearance beyond the default library styles. ```css {css-esc} ``` -------------------------------- ### Order DataTable Rows Ascending (Repeat) Source: https://github.com/datatables/datatablessrc/blob/master/test/performance/common.txt This test orders the DataTable rows in ascending order again. It's part of a loop to repeatedly test sorting responsiveness. ```javascript it('Do something in the browser', function() { table.order([0, 'asc']).draw(); }); ``` -------------------------------- ### Select Cells by Row Order Source: https://github.com/datatables/datatablessrc/blob/master/test/performance/common.txt This snippet selects cells based on the applied row ordering. It verifies that cell selection works correctly with ordered data. ```javascript it('Cells - order [' + i + ']', function() { var rowIndexes = table .rows(null, { order: 'applied' }) .indexes() .toArray(); var cells = table.cells(rowIndexes, null, { order: 'applied' }); expect(table.page.info().recordsTotal).toBe(rows); }); ``` -------------------------------- ### Select Cells by Column Order Source: https://github.com/datatables/datatablessrc/blob/master/test/performance/common.txt This snippet selects cells based on the applied column ordering. It confirms that cell selection respects column sorting. ```javascript it('Columns [' + i + ']', function() { var columnIndexes = table .columns({ order: 'applied' }) .indexes() .toArray(); var cells = table.cells(columnIndexes, null, { order: 'applied' }); expect(table.page.info().recordsTotal).toBe(rows); }); ``` -------------------------------- ### Check DataTables Version Source: https://github.com/datatables/datatablessrc/blob/master/test/performance/current.txt Verifies that the loaded DataTables version is not the specific older version '1.10.18'. This test is useful for ensuring compatibility or avoiding known issues with older versions. ```javascript it('Check this is the old version', function() { expect($.fn.dataTable.version).not.toBe('1.10.18'); }); ``` -------------------------------- ### Select Cells by Search Applied Source: https://github.com/datatables/datatablessrc/blob/master/test/performance/common.txt This snippet selects cells based on the applied search filter. It verifies that cell selection functions correctly with filtered data. ```javascript it('Cells - search [' + i + ']', function() { var rowIndexes = table .rows(null, { order: 'applied' }) .indexes() .toArray(); var cells = table.cells(rowIndexes, null, { search: 'applied' }); expect(table.page.info().recordsTotal).toBe(rows); }); ``` -------------------------------- ### Order DataTable Rows Source: https://github.com/datatables/datatablessrc/blob/master/test/performance/common.txt This test orders the DataTable rows in descending order. It's used to ensure responsiveness during sorting operations. ```javascript it('Do something in the browser', function() { table.order([0, 'desc']).draw(); }); ``` -------------------------------- ### Order DataTable Rows Ascending Source: https://github.com/datatables/datatablessrc/blob/master/test/performance/common.txt This test orders the DataTable rows in ascending order. It's used to ensure responsiveness during sorting operations. ```javascript it('Do something in the browser to stop timeout', function() { table.order([0, 'asc']).draw(); }); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.