72 lines
No EOL
2 KiB
JavaScript
72 lines
No EOL
2 KiB
JavaScript
// Get the spell json based on choosen language defaultLanguage
|
|
|
|
var jsonsource = "".concat(
|
|
"../data/spells/spells-grimoire-",
|
|
$.defaultLanguage.slice(0, 2),
|
|
".json"
|
|
);
|
|
var alldata;
|
|
// Fetch data from server
|
|
fetch(jsonsource)
|
|
.then((response) => response.json())
|
|
.then((data) => {
|
|
// load fetched data into grid
|
|
alldata = data.spell;
|
|
console.log(alldata);
|
|
|
|
//document.getElementById("spell-list")
|
|
$("#spell-list").w2grid({
|
|
name: "Spells",
|
|
box: "#spellgrid",
|
|
show: {
|
|
header:false,
|
|
toolbar: true,
|
|
footer: false,
|
|
selectColumn: true
|
|
},
|
|
multiSelect: true,
|
|
liveSearch: true,
|
|
multiSearch: true,
|
|
fixedBody: false,
|
|
records: alldata,
|
|
columns: [
|
|
{ field: "name", text: "Name",sortable: true, },
|
|
{ field: "desc", text: "Description",size:"500%",style:"test" },
|
|
{ field: "source", text: "Source",sortable: true, },
|
|
{ field: "page", text: "Page",sortable: true, },
|
|
{ field: "level", text: "Level",sortable: true, },
|
|
{ field: "school", text: "School",sortable: true, },
|
|
{ field: "components", text: "Components", },
|
|
{ field: "duration", text: "Duration", },
|
|
|
|
],
|
|
async onSelect(event) {
|
|
await event.complete
|
|
console.log('select', event.detail, this.getSelection())
|
|
},
|
|
onClick(event) {
|
|
let record = this.get(event.detail.recid)
|
|
//grid2.clear()
|
|
/*grid2.add([
|
|
{ recid: 0, name: 'ID:', value: record.recid },
|
|
{ recid: 1, name: 'First Name:', value: record.fname },
|
|
{ recid: 2, name: 'Last Name:', value: record.lname },
|
|
{ recid: 3, name: 'Email:', value: record.email },
|
|
{ recid: 4, name: 'Date:', value: record.sdate }
|
|
])*/
|
|
console.log(record)
|
|
}
|
|
});
|
|
});
|
|
|
|
|
|
window.multi = function(el) {
|
|
grid.multiSelect = el.checked
|
|
grid.selectNone()
|
|
grid.refresh()
|
|
}
|
|
|
|
window.selColumn = function(flag) {
|
|
grid.show.selectColumn = flag
|
|
grid.refresh()
|
|
} |