Find instances of dhtmlxGrid without global variable

Is it possible to find all instances of dhtmlxGrid on a page or in a container without having a global variable? See code snippet below


<div id="container"></div>
<script>
  // return existing grid if container of id "the_id" 
  //     has an existing dhtmlxGridObject associated to it. 
  //  otherwise return null
function dhtmlxGridExists(the_id){
    // how to check to see if a dhtmlxGrid objects exists in the container??
    return null;
}

mygrid = dhtmlxGridExists("container");
if(mygrid == null) mygrid = new dhtmlXGridObject("container");
</script>

This is not documented API and can be changed in next versions.

function dhtmlxGridExists(the_id){
    return document.getElementById(the_id).grid || null;
}

Thanks. Will keep this in mind

Thanks a lot. :smiley: