la recherche devient insensible à la casse

This commit is contained in:
Christophe 2020-05-06 23:37:47 +02:00
parent c57fc2155d
commit ef82382f33
3 changed files with 32 additions and 37 deletions

1
.gitignore vendored
View file

@ -1 +1,2 @@
node_modules
yarn.lock

View file

@ -7,7 +7,7 @@ jQuery(function() {
console.time('Chargement de VueJs APRES Ajax');
$.ajax({
url: url,
async: true
async: true,
}).done(function () {
if (parseInt(id) > 0) {
app.rechargerJson(id);
@ -79,15 +79,15 @@ let monTableau = {
type: Array,
default: function () {
return [10, 20, 50, 'Tous'];
}
},
},
apiuri: {
type: String,
required: true
required: true,
},
objet: {
type: String
}
type: String,
},
},
data: function () {
return {
@ -101,7 +101,7 @@ let monTableau = {
pages: [],
triOrders: [],
triProps: [],
selectTr: []
selectTr: [],
};
},
mounted() {
@ -110,17 +110,15 @@ let monTableau = {
computed: {
tableau: function () {
return this.pagination(
this.table.filter(ligne => {
this.table.filter((ligne) => {
if (this.search) {
if (!Object.values(ligne).every(el => el.indexOf(this.search))) {
return ligne;
}
return Object.values(ligne).toString().toLowerCase().indexOf(this.search) < 0 ? false : true;
} else {
return ligne;
return true;
}
})
);
}
},
},
watch: {
tableau() {
@ -132,7 +130,7 @@ let monTableau = {
} else {
this.parPage = e;
}
}
},
},
methods: {
chargerJson(id) {
@ -141,13 +139,13 @@ let monTableau = {
url += '&id=' + id;
}
fetch(url)
.then(response => response.json())
.then(data => {
.then((response) => response.json())
.then((data) => {
let config = data.shift();
this.header = config.header;
this.crayons = config.crayons;
if (parseInt(id) > 0) {
let i = this.table.findIndex(ligne => ligne.id === parseInt(id));
let i = this.table.findIndex((ligne) => ligne.id === parseInt(id));
Vue.set(this.table, i, data[0]);
} else {
this.table = data;
@ -156,7 +154,7 @@ let monTableau = {
console.timeEnd('Chargement de VueJs APRES Ajax');
});
})
.catch(error => console.log(error));
.catch((error) => console.log(error));
},
setPages() {
let nombreDePages = Math.ceil(this.table.length / this.parPage);
@ -209,7 +207,7 @@ let monTableau = {
this.selectTr.push(id);
}
}
}
},
},
template: `
<div class="gamutable">
@ -255,7 +253,7 @@ let monTableau = {
</div>
</div>
</div>
</div>`
</div>`,
};
let app = new Vue({
@ -264,6 +262,6 @@ let app = new Vue({
methods: {
rechargerJson(id) {
this.$refs.montableau.chargerJson(id);
}
}
},
},
});

View file

@ -132,13 +132,9 @@ var monTableau = {
return this.pagination(this.table.filter(function (ligne) {
if (_this.search) {
if (!Object.values(ligne).every(function (el) {
return el.indexOf(_this.search);
})) {
return ligne;
}
return Object.values(ligne).toString().toLowerCase().indexOf(_this.search) < 0 ? false : true;
} else {
return ligne;
return true;
}
}));
}