Subrow Close on demand

Hi all, I need to close opened subrow right before another subrow gets open, meaning when I click on the cross for a subrow to open I need to any other opened subrow to close before clicked subrow is opened.
And is there is a way to close all open sub_row in the grid, or maybe to close subrow by using rowID?
Thanks in advance

dhtmlxGrid doesn’t have api to close all sub grids. You should iterate over each row and close each sub grid manually

grid.cellById(row_id,cell_index).close();