UNPKG

812 BJavaScriptView Raw
1
2//import { Template } from '../../src/bunny.template';
3//import { DataTable } from '../../src/DataTable';
4
5Template.define('users_row_template', {
6 edit: (btn, user) => {
7 btn.href += user.index;
8 },
9 remove: (btn, user) => {
10 btn.href += user.index;
11 btn.addEventListener('click', (e) => {
12 e.preventDefault();
13 // show custom confirm popup
14 // in this example we will just call native confirm()
15 if (confirm('Are you sure?')) {
16 window.location = btn.href;
17 }
18 })
19 }
20});
21
22DataTable.onRedraw(document.getElementsByTagName('datatable')[0], (data) => {
23 console.info('Switched to page ' + data.current_page);
24 console.info('First user name is:' + data.data[0].name);
25});