|
result;
public click() {
new DataManager({ url: SERVICE_URI, adaptor: new ODataAdaptor() })
.executeQuery(new Query().range(1, 4))
.then((e: ReturnOption) => {
let result: any = e.result;
for (let i: number = 0; i < result.length; i++) {
this.accordionItems.push({
header: result[i][this.mapping.header],
content: result[i][this.mapping.content],
expanded: true
});
}
this.result = this.accordionItems;
console.log(this.result);
console.log(this.acrdnInstance);
console.log(this.acrdnInstance.items);
}); } |
Hi Jonas,
Thanks for your patience.
We have checked your modified sample at our end and let you know that you have assigned the e.result directly to the accordion items when clicking the button. But the e.result has multiple items inside it. So we should map the relevant fields to the accordion header and the content fields like below. So if this.result value got changed dynamically the accordion items also will change the same.
result;
public click() {new DataManager({ url: SERVICE_URI, adaptor: new ODataAdaptor() }).executeQuery(new Query().range(1, 4)).then((e: ReturnOption) => {let result: any = e.result;for (let i: number = 0; i < result.length; i++) {this.accordionItems.push({header: result[i][this.mapping.header],content: result[i][this.mapping.content],expanded: true});}this.result = this.accordionItems;
console.log(this.result);console.log(this.acrdnInstance);console.log(this.acrdnInstance.items);});
}
Kindly refer and follow the above solution at your end and let us know if this comes close to your requirement.
Regards,Balasubramanian S