$
This commit is contained in:
@@ -8,7 +8,7 @@ export default class View {
|
||||
this.etab = document.getElementById("etab")
|
||||
this.btn = document.getElementById("selector-top-btn")
|
||||
this.btn.onclick = () => {
|
||||
this.updateMenu({name: " ", count: 0}, "previous")
|
||||
this.updateMenu(" ", "previous")
|
||||
}
|
||||
|
||||
log("Selector", "View 1/3")
|
||||
@@ -32,13 +32,7 @@ export default class View {
|
||||
let li = document.createElement("li")
|
||||
li.className = "selector-list-inner"
|
||||
li.onclick = () => {
|
||||
this.updateMenu(
|
||||
{
|
||||
name: document.getElementById(`menu0-${e.name}`).innerText,
|
||||
count: parseInt(document.getElementById(`menu0-${e.name}-count`).innerText)
|
||||
},
|
||||
"next"
|
||||
)
|
||||
this.updateMenu(document.getElementById(`menu0-${e.name}`).innerText, "next")
|
||||
}
|
||||
|
||||
let name = document.createElement("a")
|
||||
@@ -48,7 +42,6 @@ export default class View {
|
||||
|
||||
let count = document.createElement("span")
|
||||
count.innerText = e.count
|
||||
count.id = `menu0-${e.name}-count`
|
||||
count.className = "selector-list-counts"
|
||||
|
||||
li.appendChild(name)
|
||||
@@ -63,7 +56,7 @@ export default class View {
|
||||
|
||||
/**
|
||||
* Pour afficher en haut a gauche le chemin courant.
|
||||
* @param { array[] } path Chemin courant.
|
||||
* @param { string[] } path Chemin courant.
|
||||
* */
|
||||
renderPath(path) {
|
||||
this.path.innerText = `${path[0]} / ${path[1]} / ${path[2]}`
|
||||
@@ -75,32 +68,14 @@ export default class View {
|
||||
* @param { json } data La liste des etablissements.
|
||||
* */
|
||||
renderEtab(data) {
|
||||
this.etab.innerHTML = ""
|
||||
let table = document.createElement("table")
|
||||
let trow = document.createElement("tr")
|
||||
|
||||
let th1 = document.createElement("th")
|
||||
th1.innerText = "Nom"
|
||||
|
||||
let th2 = document.createElement("th")
|
||||
th2.innerText = "Ville"
|
||||
|
||||
let th3 = document.createElement("th")
|
||||
th3.innerText = "Dpt"
|
||||
|
||||
let th4 = document.createElement("th")
|
||||
th4.innerText = "Moyenne"
|
||||
|
||||
let th5 = document.createElement("th")
|
||||
th5.innerText = "Selectivite"
|
||||
|
||||
trow.appendChild(th1)
|
||||
trow.appendChild(th2)
|
||||
trow.appendChild(th3)
|
||||
trow.appendChild(th4)
|
||||
trow.appendChild(th5)
|
||||
table.appendChild(trow)
|
||||
|
||||
this.etab.innerHTML =
|
||||
"<tr>" +
|
||||
" <th>Nom</th>" +
|
||||
" <th>Ville</th>" +
|
||||
" <th>Dept</th>" +
|
||||
" <th>Moyenne</th>" +
|
||||
" <th>Selectivite</th>" +
|
||||
"</tr>"
|
||||
|
||||
data.forEach((e) => {
|
||||
let etab = e.fields.g_ea_lib_vx
|
||||
@@ -132,15 +107,13 @@ export default class View {
|
||||
tr.appendChild(td4)
|
||||
tr.appendChild(td5)
|
||||
|
||||
table.appendChild(tr)
|
||||
this.etab.appendChild(tr)
|
||||
})
|
||||
|
||||
this.etab.appendChild(table)
|
||||
}
|
||||
|
||||
/**
|
||||
* Envoyer dans le controlleur tous les events fait.
|
||||
* @param { {name: string, count: int} } selection Ce qu'on va utiliser pour le &refine.
|
||||
* @param { string } selection Ce qu'on va utiliser pour le &refine.
|
||||
* @param { string } direction Retour en arriere ou aller en avant. { "previous", "next" }
|
||||
* */
|
||||
updateMenu(selection, direction) {
|
||||
|
Reference in New Issue
Block a user