paginate(new_page)
change to new_page
let mytable = new JSTable('#table'); mytable.paginate(5);
search(query)
search for query
let mytable = new JSTable('#table'); mytable.search("Denmark");
You could update the search input by addressing the CSS selector defined in the config:
let searchfield = document.querySelector('.dt-input'); // or alternatively: // let searchfield = document.querySelector('.'+table.config.classes.input); searchfield.value = 'Denmark';
sort(column, direction, initial = false)
change the sorting of the table
let mytable = new JSTable('#table'); myTable.sort(0, 'asc');
Change elements per page
To change the elements per page, you need to modify the select element and update the table:
let select = document.querySelector('.dt-selector'); // or alternatively: // let select = document.querySelector('.'+table.config.classes.selector); select.value = 10; table.update();