Search
10784 results 221-230
Examples
- Buttons › Space between buttonsThe
spacerbutton type is unique in Buttons in that it doesn't actually display a button or anything the end user can interact with. Rather it simply introduces a space between buttons, allowing easy visual grouping. - Buttons › Select integration - export selected rowsButton's data export can interface with the Select extension for DataTables, and will automatically export only the selected rows, if any rows are selected. If no rows are selected in the table, all rows will be exported. If this behaviour is not what you desire, set the
selectedoption of theexportOptions.modifierin the button you wish disable this action for to benull. It will then include all rows in the export, regardless of any rows being selected (the Print button in this example demonstrates this). Equally, if you want to force the export to include only exported rows, even if no rows are selected (i.e. none would be exported), set this parameter to betrue. - Buttons › Page length (button)Buttons are often inserted into the document where DataTables default page length
selectwidth would go (top left), to provide controls or table information at each of the four corners of the table. However, you may wish to keep still allow the end user to change the page length, while also providing buttons. ThepageLengthbutton acts in exactly the same way as the default length list, but is available as a standard button that uses a collection to display the options. This example shows thepageLengthbutton being used. - Buttons › Multiple button groupsDue to Buttons being registered with DataTables as a feature you can create multiple different button groups, each with its own set of buttons and addressable by the API. This can be particularly useful if you wish to display button groups with different functionality (file export, editing, etc). In this example the
buttonsfeature is used twice to insert one button at the top of the table and another two at the bottom. - Buttons › Keyboard activationKeyboard navigation is essential for fast navigation of a table operations and also for good accessibility. Buttons provides the ability to give each button a key binding - i.e. a key combination that when pressed will activate the button's action. The key binding can be given as a single character if you wish to listen for an unmodified key press, or as an object if you wish it to only be activated when a modifier key such as shift, alt, etc, is pressed. Only when there is no element on the page that has focus will Buttons act on a key press. This means that if you search for (for example) 1 in the DataTables search box, it will not activate Button 1 in this example. Having said that, adding a modifier key, such as shift or alt can often be useful to prevent accidental triggering of a button. This example shows two buttons; the first will be activated if
1is pressed on the keyboard. The second requiresshift + 2to be pressed. - Buttons › File exportExporting data from a table can often be a key part of a complex application. The Buttons extension for DataTables provides three plug-ins that provide overlapping functionality for data export: HTML5 export buttons - makes use of HTML5 APIs to create files client-side Print button Both sets of buttons provide: Copy to clipboard Save as Excel (XLSX) Save as CSV Save as PDF Display a print view Buttons provides button types that will alias HTML5 buttons. These are:
copy,csv,excel,pdf. This example shows those four button types, plusprint, being used with all required dependencies being loaded. - Buttons › Custom HTML in Buttons CollectionThis example shows how custom HTML can be used to break up buttons. This has a wide variety of use cases, here we are using it in the popover to add relevant headings to better describe the buttons functionality. There is nothing to limit you here, you can create whatever you please and display it within the buttons collection.
- Buttons › Multi-level collectionsAs of Buttons 1.1, basic options for displaying a collection inside a collection is possible simply by using a collection button in the
buttonsarray for another collection. This Inception like behaviour basically means that multi-level collections are possible. It is worth noting that only a single collection can be shown at a time, so the display of any sub-collection will replace the display of the existing collection. This example shows a custom collection button (matching the simple collection example) with the addition of a column visibility button, which when activated will show another collection of buttons, this time controlling the column visibility. - Buttons › Auto close collectionButtons' collections will remain on screen when a sub-button is activated by default, but this behaviour isn't always desirable and can be controlled through the use of the
autoCloseoption as shown in this example. In every other regard it is identical to the collections example but in this case the collection will close automatically when one of the sub-buttons is selected. - AutoFill › Scrolling DataTableWhen dragging an AutoFill handle, the table (if DataTables scrolling is enabled) or the window will be automatically scrolled, as you approach the edge of the scrolling component. The example below shows the effect with DataTables scrolling (and also window if needed).
Forum
- 26th Mar 2024Issue with .on( 'click', 'tr', function ()buttons:[ { text: 'Approve Hours', init: function(api, node, config) { $(node).removeClass('dt-button
- 27th Mar 2024Editor Total Rowdefinition in the Editor init code, for example: const
- 27th Mar 2024Header checbox for select all don't work with select2it in the Datatables init code like this example.
- 26th Mar 2024How to disable remove button until condition is met.name: 'remove', editor: editor, init: function (dt, node, config)
- 26th Mar 2024Select row by index by the order currently appliedyour data and Datatables init code to use in
- 25th Mar 2024My data table has two pages but on first load it shows only page number 1 not showing page number 2.obvious in the Datatables init code. I'm not sure
- 14th Mar 2024Dynamic Columns6-9, into your Datataables init code, lines 25-30 to
- 13th Mar 2024Changing language at runtime without table destroy in 2.0.0params that a new init could require. In my
- 5th Mar 2024BS5 Floating Labels: my solutionwere set in the initialisation object you could use init(), but that doesn't get
- 5th Mar 2024Manipulate ajax.dataSrc after the factto change ajax.dataSrc after init before, but I could