I am trying to create a sub set of the list from a given list.
For example, I have a list of fields which can be checked and unchecked. I am trying to create a sub list which will only have those items which are checked.
I am unable to create it using Javascript as I am very new to the language. Can someone please help me with it?
this.attributeCategoryOptions.forEach((el) => {
el.description += ' Required';
});
if (this.args.formData.descriptionDefaultFieldId)
this.descriptionDefaultFieldSelected = this.descriptionDefaultFieldOptions.find((el) =>
this.args.formData.descriptionDefaultFieldId === el.id);
if (this.args.formData.iconUrl)
this.iconUrlSelected = this.iconUrlOptions.find((el) =>
this.args.formData.iconUrl === el.id);
if (this.args.formData.attributeDescriptionIdOptions != null) {
this.attributeCategoryOptions.forEach((listItem) => {
listItem.checked = false;
this.args.formData.attributeDescriptionIdOptions.forEach((attr) => {
if (listItem.id === attr.id) {
listItem.checked = attr.checked;
}
});
})
Aucun commentaire:
Enregistrer un commentaire