How to access (iterate on) all ej2 objects in a page from JavaScript (jQuery)

I would like to iterate over all ej2 objects on a page, for example on all Grids.

I do know how to access the Grid object by its ID:  $("#myGrid")[0].ej2_instances[0].

However I would like to write a more generic JavaScript code which iterates over all objects on a page.
Is this possible?



3 Replies 1 reply marked as answer

MS Manivel Sellamuthu Syncfusion Team June 23, 2020 05:48 AM UTC

Hi Gabor, 

Greetings from Syncfusion support. 

Yes. you can iterate all Grids in the page using the class name

var gridElements = document.getElementsByClassName('e-grid') 

Please let us know, if you need further assistance. 

Regards, 
Manivel 


Marked as answer

GA gabor June 23, 2020 11:34 AM UTC

Thx, it works.


MS Manivel Sellamuthu Syncfusion Team June 24, 2020 04:13 AM UTC

Hi Gabor, 

Thanks for your update. 

We are glad that the provided suggestion worked. 

Please get back to us if you need further assistance. 

Regards, 
Manivel 


Loader.
Up arrow icon