Force collection rebuild for getElements()
Hi all, I have a question regarding getElements() and it's behavior. I've found that when I apply styles to the returned collection from getElements() the styles do not update on the UI. However, when I apply styles to the returned collection from everyItem() it correctly updates the UI.
I read this post explaining that getElements() returns a static array which limits the interaction with InDesign to improve performance. https://community.adobe.com/t5/indesign-discussions/quot-everyitem-getelements-quot-what-use/m-p/8801639#M36581
Here's my issue: I would like to selectively apply styles to cells. EveryItem() does not support js lambda expressions like .filter() so my only option is to use getElements(). Is there a way to force an interaction between the returned array from getElements() and InDesign so the style is reflected properly?
Style updated/rendered correctly:
var myCells = table.cells.everyItem();
myCells.appliedCellStyle = stylez;
Style not updated/rendered correctly:
var myCells = table.cells.everyItem().getElements().filter(cell => cell.extractLabel("rowType") === "0");
myCells.appliedCellStyle = stylez;
