la recherche devient insensible à la casse
This commit is contained in:
parent
c57fc2155d
commit
ef82382f33
3 changed files with 32 additions and 37 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1 +1,2 @@
|
|||
node_modules
|
||||
yarn.lock
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
jQuery(function() {
|
||||
$('#app').on('click', '.url_action', function(e) {
|
||||
jQuery(function () {
|
||||
$('#app').on('click', '.url_action', function (e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
let url = $(this).attr('href');
|
||||
|
@ -7,8 +7,8 @@ jQuery(function() {
|
|||
console.time('Chargement de VueJs APRES Ajax');
|
||||
$.ajax({
|
||||
url: url,
|
||||
async: true
|
||||
}).done(function() {
|
||||
async: true,
|
||||
}).done(function () {
|
||||
if (parseInt(id) > 0) {
|
||||
app.rechargerJson(id);
|
||||
} else {
|
||||
|
@ -17,14 +17,14 @@ jQuery(function() {
|
|||
});
|
||||
});
|
||||
|
||||
$('#app').on('click', '.modalbox', function(e) {
|
||||
$('#app').on('click', '.modalbox', function (e) {
|
||||
e.preventDefault();
|
||||
let url = $(this).attr('href');
|
||||
url += '&var_zajax=content';
|
||||
$.modalbox(url);
|
||||
});
|
||||
|
||||
$('#app').on('click', '.mediabox', function(e) {
|
||||
$('#app').on('click', '.mediabox', function (e) {
|
||||
e.preventDefault();
|
||||
let href = $(this).attr('href');
|
||||
$.fn.mediabox({ href });
|
||||
|
@ -69,7 +69,7 @@ const orderBy = (arr, props, orders) =>
|
|||
);
|
||||
console.time('Chargement de VueJS AVANT Ajax');
|
||||
console.time('Chargement de VueJs APRES Ajax');
|
||||
Vue.nextTick(function() {
|
||||
Vue.nextTick(function () {
|
||||
console.timeEnd('Chargement de VueJS AVANT Ajax');
|
||||
});
|
||||
|
||||
|
@ -77,19 +77,19 @@ let monTableau = {
|
|||
props: {
|
||||
tparpage: {
|
||||
type: Array,
|
||||
default: function() {
|
||||
default: function () {
|
||||
return [10, 20, 50, 'Tous'];
|
||||
}
|
||||
},
|
||||
},
|
||||
apiuri: {
|
||||
type: String,
|
||||
required: true
|
||||
required: true,
|
||||
},
|
||||
objet: {
|
||||
type: String
|
||||
}
|
||||
type: String,
|
||||
},
|
||||
},
|
||||
data: function() {
|
||||
data: function () {
|
||||
return {
|
||||
table: [],
|
||||
header: [],
|
||||
|
@ -101,26 +101,24 @@ let monTableau = {
|
|||
pages: [],
|
||||
triOrders: [],
|
||||
triProps: [],
|
||||
selectTr: []
|
||||
selectTr: [],
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.chargerJson();
|
||||
},
|
||||
computed: {
|
||||
tableau: function() {
|
||||
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,22 +139,22 @@ 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;
|
||||
}
|
||||
Vue.nextTick(function() {
|
||||
Vue.nextTick(function () {
|
||||
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);
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue