|
Post by danielbeeke on Dec 18, 2020 11:03:04 GMT
I would like to use gridjs within uHtml, is that possible?
|
|
|
Post by danielbeeke on Dec 18, 2020 11:12:47 GMT
Woops, I just had a stupid type somewhere. It works.
``` const grid = new Grid({ columns: ['Pokemon', 'URL'], pagination: { limit: 5, server: { url: (prev, page, limit) => `${prev}?limit=${limit}&offset=${page * limit}` } }, server: { url: 'https://pokeapi.co/api/v2/pokemon', then: data => data.results.map(pokemon => [ pokemon.name, ghtml(`<a href='${pokemon.url}'>Link to ${pokemon.name}</a>`) ]), total: data => data.count } });
const table = document.createElement('div') grid.render(table) return this.html`<div>${table}</div>` ```
|
|