After an IG is saved (using native button and custom save proc), I notice that it remains in edit mode. This is an issue as I have some buttons at the top of the page that I am using for bulk processes (like bulk edit where I will select multiple records). I only have this button active on the condition there is at least 1 record selected (and grid is not in edit mode). This works fine until I save, at which point the grid stays in edit mode.
I use this code to check edit mode status:
apex.region(pGridId).call("getActions").get("edit);
So ultimately I want to turn off edit mode after my grid has saved.
I've found this method in the docs but I can't get it to work.

When I run the example code above in the console (replacing “.selector” with "#the-static-id-of-my-grid")
I get - "cannot call methods on grid prior to initialization; attempted to call method ‘setEditMode’.
Can someone explain how to use this code correctly, or suggest another way of doing this?
Thanks in advance.