Thank you for looking at my stack, Klaus
For those who are curious, the problem was that the array I was using for dgdata had text, not numbers, for its keys, and I didn't know that datagrids can't work with text keys. But now I know! I don't think I would have figured that out by myself.