How to set row-ID?

I have a dthmlXGridObject which is initialized using JSON(a custom JSON). However the custom JSON does not include any row-IDs.

treegrid = new dhtmlXGridObject('order-tree-grid'); treegrid.load('/some/api', ..., js);
When I’m trying to set the row-ID,

treegrid.setRowId(0, "row1");

I get the following exception:

Is this the right way to set the row-IDs? What’s going wrong here? How can I set the row-IDs?

Be sure that you are calling setRowId from the data loading callback ( loading is async, so placing this command just next to load will not work, as data is not really loaded yet )