2023-03-05 22:58:21 +00:00
|
|
|
// Get the spell json based on choosen language defaultLanguage
|
2023-03-05 01:03:48 +00:00
|
|
|
|
2023-03-05 22:58:21 +00:00
|
|
|
var jsonsource = "".concat(
|
|
|
|
"../data/spells/spells-grimoire-",
|
|
|
|
$.defaultLanguage.slice(0, 2),
|
|
|
|
".json"
|
2023-03-05 01:03:48 +00:00
|
|
|
);
|
2023-03-05 22:58:21 +00:00
|
|
|
var test;
|
|
|
|
// Fetch data from server
|
|
|
|
fetch(jsonsource)
|
|
|
|
.then((response) => response.json())
|
|
|
|
.then((data) => {
|
|
|
|
// load fetched data into grid
|
|
|
|
test = data.spell;
|
|
|
|
console.log(test);
|
2023-03-05 01:03:48 +00:00
|
|
|
|
2023-03-05 22:58:21 +00:00
|
|
|
//document.getElementById("spell-list")
|
|
|
|
$("#spell-list").w2grid({
|
|
|
|
name: "Spells",
|
|
|
|
box: "#spellgrid",
|
|
|
|
show: {
|
|
|
|
header:false,
|
|
|
|
toolbar: true,
|
|
|
|
footer: false,
|
|
|
|
selectColumn: true
|
|
|
|
},
|
|
|
|
multiSelect: true,
|
|
|
|
multiSearch: true,
|
|
|
|
fixedBody: false,
|
|
|
|
records: test,
|
|
|
|
columns: [
|
|
|
|
{ field: "name", text: "Name", size: "30%",sortable: true, attr: 'align=center' },
|
|
|
|
{ field: "id", text: "ID", size: "30%" },
|
|
|
|
{ field: "email", text: "Email", size: "40%" },
|
|
|
|
{ field: "sdate", text: "Start Date", size: "120px" },
|
|
|
|
],
|
|
|
|
async onSelect(event) {
|
|
|
|
await event.complete
|
|
|
|
console.log('select', event.detail, this.getSelection())
|
|
|
|
},
|
|
|
|
onClick(event) {
|
|
|
|
let record = this.get(event.detail.name)
|
|
|
|
//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)
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
2023-03-05 01:03:48 +00:00
|
|
|
|
|
|
|
|
2023-03-05 22:58:21 +00:00
|
|
|
window.multi = function(el) {
|
|
|
|
grid.multiSelect = el.checked
|
|
|
|
grid.selectNone()
|
|
|
|
grid.refresh()
|
|
|
|
}
|
2023-03-05 01:03:48 +00:00
|
|
|
|
2023-03-05 22:58:21 +00:00
|
|
|
window.selColumn = function(flag) {
|
|
|
|
grid.show.selectColumn = flag
|
|
|
|
grid.refresh()
|
|
|
|
}
|