function initUsersGrid() { window.usersGrid = new gridjs.Grid({ columns: [ { id: 'user-selector', name: 'Select', plugin: { // install the RowSelection plugin component: gridjs.plugins.selection.RowSelection, } }, { name: 'First Name', }, { name: 'Last Name', }, { name: 'User email', }, { name: 'Origin' } // { // name: 'Actions', // formatter: (cell, row) => { // if (cell == 'f') { // return ""; // } // return gridjs.h('button', { // className: 'py-2 mb-4 px-4 border rounded-md text-white bg-blue-600', // onClick: () => downloadOneFile(row.cells[0].data) // }, 'Download'); // } ], search: false, server: { url: BASE_URL + '/cp/fetch_user_list', then: data => data.map(reqs => [reqs.fname, reqs.lname, reqs.email, reqs.origin]) } }).render(document.getElementById('grid-users')); }