Select TreeGrid node by ID

How do I select a TreeGrid node by ID (primaryKey)?

I found the TreeGrid.selectRecord(record) method but how do I get a reference to the record from the TreeGrid or DataSource given the primaryKey of the record?

grid.data.find(primaryKeyField, pkValue) is one way.

That’s working now. Thanks for the quick reply!

The node I am selecting is in a TreeGrid. How would I go about programatically expanding the tree to expose the node in question and scroll the tree to ensure it is visible?

Use tree.open() as grid.data.open(record) to programmatically expand something.

See this thread on scrolling to a record.