Hi,
I have an array and I want to display it by group with label.
Please see the screenshot of the sample array
I want to achieve
Hi,
I have an array and I want to display it by group with label.
Please see the screenshot of the sample array
I want to achieve
você pode adicionar a data como a chave do array, por exemplo a data 10/11/2018, na key do array ficaria 20181110, e coloque para ordenar de forma decrescente.
I solved it
let currentLetter = false;
let currentContacts = [];
let currentDatas = [];
for(let i = 0; i < this.dataFinalPota.length; i++) {
this.ahh = this.dataFinalPota[i].matchTime.slice(0,7);
if(this.ahh != currentLetter) {
currentLetter = this.ahh;
let newGroup = {
letter: currentLetter,
contacts: [],
taes: []
};
currentContacts = newGroup.contacts;
currentDatas = newGroup.taes;
this.groupedContacts.push(newGroup);
}
currentContacts.push(this.ahh);
currentDatas.push(this.dataFinalPota[i]);
}
The code in the above post has a serious flaw. Controller-level object properties should not churn needlessly within a function. There is no good reason for having this.ahh
be an object property. It should instead be lexically scoped.