We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

spreadsheet has loaded

Hello all,

Is there a flag set that tells that the spreadsheet has loaded?

I want to run some code from javascript after the control has loaded.

$(document).ready(function () {

                         alert("Document");

       

        var grid1 = document.getElementById("spreadsheet1")[0].ej2_instances[0];
}



4 Replies 1 reply marked as answer

SP Sangeetha Priya Murugan Syncfusion Team December 13, 2022 12:08 PM UTC

We have triggered the created event after the spreadsheet component gets loaded in the DOM. So, you can use created event based on your need.

https://ej2.syncfusion.com/javascript/documentation/api/spreadsheet#created




SW Stephen Welborn December 13, 2022 05:14 PM UTC

Hello,

I used 

<ejs-spreadsheet id="spreadsheet1">

    <e-spreadsheet-sheets>

        <e-spreadsheet-sheet>

            <e-spreadsheet-ranges>

                <e-spreadsheet-range dataSource="ViewBag.DefaultData"></e-spreadsheet-range>

            </e-spreadsheet-ranges>

        </e-spreadsheet-sheet>

    </e-spreadsheet-sheets>

</ejs-spreadsheet>

 var myspreadsheet = new Spreadsheet({

        created: () => {

            var grid2 = document.getElementById("spreadsheet1");

            var grid1 = document.getElementById("spreadsheet1")[0].ej2_instances[0];

        }


     }, '#spreadsheet1');

Uncaught ReferenceError: Spreadsheet is not defined

    at CellDataBinding:86:25


We are using cshtml pages.  Please advise




Marked as answer

SW Stephen Welborn December 13, 2022 06:00 PM UTC

I found it.

ejs-spreadsheet id="spreadsheet1" created="onCreated">



SP Sangeetha Priya Murugan Syncfusion Team December 14, 2022 10:05 AM UTC

Hi Stephen,

 

We are happy to hear that you have found a solution at your end, and thanks for sharing it with us. Please contact us if you need any other assistance.


Loader.
Up arrow icon