This content has been marked as final. Show 5 replies
Try setting the selectedItems property using callLater(). It may be a timing issue.
Tried callLater (doesn't work), but here's a better idea. I actually just placed a button in the popup that I could press to "select" the items using the same code. This guarantees that all data is loaded and working. It still doesn't work.
In fact, if I make my own selection, and then click the button, it deselects everything.
What in the world?
OK - I'm definitely missing something here...
I setup another custom event. When closing the window I dispatch the selectedItems of the datagrid as ArrayCollection. In that case, it always returns null. If I change the value to "courses" (i.e. the only thing that works in my first example), it works fine.
What is so special about that one AC? Why is this conversion between array and AC messing it all up?
It appears that selectedItems is dependent on the data being absolutely identical to the dataProvider. And while I thought my data was identical, it really wasn't. In the debugger, if you look at a variable, its always: "Array (@123456)". What I found was that although the data was definitely the same, the number was not.
To fix the problem, I centralized all data to go through one data manager, whereas before I was reinitializing a different data component in each component.
So now, I'm basically calling parentApplication.dataManager.someFunction() from all of my components. This isn't good quite frankly, but by doing so, the @123456 is always the same.
If anyone else can think of a better way, I'm all ears...