syncfusion ej grid javascript method












1















I am very new to syncfusion controls for mvc. While exploring how to set dynamic datasource to grid, I came across this line of javascript code which I cannot understand. I have been through the javascript api docs for ej grid but couldn't find the meaning.



var obj = $("#Grid").ejGrid("instance");



If someone can explain the meaning and point out some reference documentation, I will be highly grateful.



The example I came across
https://help.syncfusion.com/aspnetmvc/grid/how-to



The javascript api I have been through
https://help.syncfusion.com/api/js/ejgrid#members:datasource



P.s: I know from a comment I came across that this has something to do with current instance of ej grid but I would like a solid understanding via a reference so I can understand.










share|improve this question





























    1















    I am very new to syncfusion controls for mvc. While exploring how to set dynamic datasource to grid, I came across this line of javascript code which I cannot understand. I have been through the javascript api docs for ej grid but couldn't find the meaning.



    var obj = $("#Grid").ejGrid("instance");



    If someone can explain the meaning and point out some reference documentation, I will be highly grateful.



    The example I came across
    https://help.syncfusion.com/aspnetmvc/grid/how-to



    The javascript api I have been through
    https://help.syncfusion.com/api/js/ejgrid#members:datasource



    P.s: I know from a comment I came across that this has something to do with current instance of ej grid but I would like a solid understanding via a reference so I can understand.










    share|improve this question



























      1












      1








      1








      I am very new to syncfusion controls for mvc. While exploring how to set dynamic datasource to grid, I came across this line of javascript code which I cannot understand. I have been through the javascript api docs for ej grid but couldn't find the meaning.



      var obj = $("#Grid").ejGrid("instance");



      If someone can explain the meaning and point out some reference documentation, I will be highly grateful.



      The example I came across
      https://help.syncfusion.com/aspnetmvc/grid/how-to



      The javascript api I have been through
      https://help.syncfusion.com/api/js/ejgrid#members:datasource



      P.s: I know from a comment I came across that this has something to do with current instance of ej grid but I would like a solid understanding via a reference so I can understand.










      share|improve this question
















      I am very new to syncfusion controls for mvc. While exploring how to set dynamic datasource to grid, I came across this line of javascript code which I cannot understand. I have been through the javascript api docs for ej grid but couldn't find the meaning.



      var obj = $("#Grid").ejGrid("instance");



      If someone can explain the meaning and point out some reference documentation, I will be highly grateful.



      The example I came across
      https://help.syncfusion.com/aspnetmvc/grid/how-to



      The javascript api I have been through
      https://help.syncfusion.com/api/js/ejgrid#members:datasource



      P.s: I know from a comment I came across that this has something to do with current instance of ej grid but I would like a solid understanding via a reference so I can understand.







      syncfusion






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 22 '18 at 17:27









      dopamane

      8561923




      8561923










      asked Nov 22 '18 at 14:13









      JayDJayD

      14112




      14112
























          2 Answers
          2






          active

          oldest

          votes


















          0














          From my little experience with Syncfusion controls the documentation explaining how to perform tasks is not well stated. If you have a license you can ask questions in their forum but I can tell you what little I learned perusing their forum.



          In their JS 1 version



          var obj = $("#Grid").ejGrid("instance");


          and in their JS 2 version



          var obj = document.getElementById('Grid').ej2_instances[0];


          The variable obj appears to get an object reference to the grid identified by the id Grid. I am not sure what the instance value refers to other than the examples in the documentation show it and it works when it is used.



          Not sure if I was much help.






          share|improve this answer































            0














            In the Below code example Grid – Grid ID and you can take the Grid instance using the above code example. From the instance you can get the details regarding the column, dataSource, filterSettings, sortSettings etc currently applied to ejGrid. We have given support to customize the Grid using several public method. You can call those method by taking the Grid instance.



            @(Html.EJ().Grid<EJGrid.Models.Order>("Grid")
            .Datasource((IEnumerable<object>)ViewBag.datasource)
            .AllowPaging()
            .Columns(col =>
            { col.Field("OrderID").HeaderText("Order ID").TextAlign(TextAlign.Right).Width(75).Add();
            col.Field("EmployeeID").HeaderText("Employee ID").TextAlign(TextAlign.Right).Width(90).Add();
            col.Field("Freight").HeaderText("Freight").Format("{0:c}").TextAlign(TextAlign.Right).Width(90).Add();
            col.Field("ShipCity").HeaderText("Ship City").Width(90).Add();
            col.Field("Child.Test").HeaderText("TEst").Format("{0:c}").Width(90).Add();
            col.Field("ShipCountry").HeaderText("Ship Country").Width(90).Add();
            })
            )

            <script>
            var obj = $("#Grid").ejGrid("instance");
            var value = $("#colValue").val();
            //Add custom parameter to the server
            var query = new ej.Query().addParams("EmployeeID", value);
            //Creating ejDataManager with UrlAdaptor
            var dataManager = ej.DataManager({ url: "/Home/GetData", adaptor: new ej.UrlAdaptor() });
            var promise = dataManager.executeQuery(query); promise.done(function (e) {
            //Assign the result to the grid dataSource using "dataSource" method.
            obj.dataSource(e.result);
            </script>


            To update the Grid, you can use dataSource() method. To call that method you need to take the Grid instance and call that method.



            Refer the below API documentation for your reference



            https://help.syncfusion.com/api/js/ejgrid#methods:datasource - used to update the Grid dataSource dynamically



            https://help.syncfusion.com/api/js/ejgrid#members:datasource - returns the Grid dataSource.



            Please get back to us if you have further queries.






            share|improve this answer
























            • Thanks vignesh vicky can you please point me out the documentation which specifically states what you have answered because i actually want to know where is it stated that using ejGrid("instance") will get me the current instance of grid. will mark you answer as correct once i have that reference.

              – JayD
              Nov 23 '18 at 14:03











            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53432856%2fsyncfusion-ej-grid-javascript-method%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            From my little experience with Syncfusion controls the documentation explaining how to perform tasks is not well stated. If you have a license you can ask questions in their forum but I can tell you what little I learned perusing their forum.



            In their JS 1 version



            var obj = $("#Grid").ejGrid("instance");


            and in their JS 2 version



            var obj = document.getElementById('Grid').ej2_instances[0];


            The variable obj appears to get an object reference to the grid identified by the id Grid. I am not sure what the instance value refers to other than the examples in the documentation show it and it works when it is used.



            Not sure if I was much help.






            share|improve this answer




























              0














              From my little experience with Syncfusion controls the documentation explaining how to perform tasks is not well stated. If you have a license you can ask questions in their forum but I can tell you what little I learned perusing their forum.



              In their JS 1 version



              var obj = $("#Grid").ejGrid("instance");


              and in their JS 2 version



              var obj = document.getElementById('Grid').ej2_instances[0];


              The variable obj appears to get an object reference to the grid identified by the id Grid. I am not sure what the instance value refers to other than the examples in the documentation show it and it works when it is used.



              Not sure if I was much help.






              share|improve this answer


























                0












                0








                0







                From my little experience with Syncfusion controls the documentation explaining how to perform tasks is not well stated. If you have a license you can ask questions in their forum but I can tell you what little I learned perusing their forum.



                In their JS 1 version



                var obj = $("#Grid").ejGrid("instance");


                and in their JS 2 version



                var obj = document.getElementById('Grid').ej2_instances[0];


                The variable obj appears to get an object reference to the grid identified by the id Grid. I am not sure what the instance value refers to other than the examples in the documentation show it and it works when it is used.



                Not sure if I was much help.






                share|improve this answer













                From my little experience with Syncfusion controls the documentation explaining how to perform tasks is not well stated. If you have a license you can ask questions in their forum but I can tell you what little I learned perusing their forum.



                In their JS 1 version



                var obj = $("#Grid").ejGrid("instance");


                and in their JS 2 version



                var obj = document.getElementById('Grid').ej2_instances[0];


                The variable obj appears to get an object reference to the grid identified by the id Grid. I am not sure what the instance value refers to other than the examples in the documentation show it and it works when it is used.



                Not sure if I was much help.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 22 '18 at 22:07









                Ronald WalcottRonald Walcott

                1




                1

























                    0














                    In the Below code example Grid – Grid ID and you can take the Grid instance using the above code example. From the instance you can get the details regarding the column, dataSource, filterSettings, sortSettings etc currently applied to ejGrid. We have given support to customize the Grid using several public method. You can call those method by taking the Grid instance.



                    @(Html.EJ().Grid<EJGrid.Models.Order>("Grid")
                    .Datasource((IEnumerable<object>)ViewBag.datasource)
                    .AllowPaging()
                    .Columns(col =>
                    { col.Field("OrderID").HeaderText("Order ID").TextAlign(TextAlign.Right).Width(75).Add();
                    col.Field("EmployeeID").HeaderText("Employee ID").TextAlign(TextAlign.Right).Width(90).Add();
                    col.Field("Freight").HeaderText("Freight").Format("{0:c}").TextAlign(TextAlign.Right).Width(90).Add();
                    col.Field("ShipCity").HeaderText("Ship City").Width(90).Add();
                    col.Field("Child.Test").HeaderText("TEst").Format("{0:c}").Width(90).Add();
                    col.Field("ShipCountry").HeaderText("Ship Country").Width(90).Add();
                    })
                    )

                    <script>
                    var obj = $("#Grid").ejGrid("instance");
                    var value = $("#colValue").val();
                    //Add custom parameter to the server
                    var query = new ej.Query().addParams("EmployeeID", value);
                    //Creating ejDataManager with UrlAdaptor
                    var dataManager = ej.DataManager({ url: "/Home/GetData", adaptor: new ej.UrlAdaptor() });
                    var promise = dataManager.executeQuery(query); promise.done(function (e) {
                    //Assign the result to the grid dataSource using "dataSource" method.
                    obj.dataSource(e.result);
                    </script>


                    To update the Grid, you can use dataSource() method. To call that method you need to take the Grid instance and call that method.



                    Refer the below API documentation for your reference



                    https://help.syncfusion.com/api/js/ejgrid#methods:datasource - used to update the Grid dataSource dynamically



                    https://help.syncfusion.com/api/js/ejgrid#members:datasource - returns the Grid dataSource.



                    Please get back to us if you have further queries.






                    share|improve this answer
























                    • Thanks vignesh vicky can you please point me out the documentation which specifically states what you have answered because i actually want to know where is it stated that using ejGrid("instance") will get me the current instance of grid. will mark you answer as correct once i have that reference.

                      – JayD
                      Nov 23 '18 at 14:03
















                    0














                    In the Below code example Grid – Grid ID and you can take the Grid instance using the above code example. From the instance you can get the details regarding the column, dataSource, filterSettings, sortSettings etc currently applied to ejGrid. We have given support to customize the Grid using several public method. You can call those method by taking the Grid instance.



                    @(Html.EJ().Grid<EJGrid.Models.Order>("Grid")
                    .Datasource((IEnumerable<object>)ViewBag.datasource)
                    .AllowPaging()
                    .Columns(col =>
                    { col.Field("OrderID").HeaderText("Order ID").TextAlign(TextAlign.Right).Width(75).Add();
                    col.Field("EmployeeID").HeaderText("Employee ID").TextAlign(TextAlign.Right).Width(90).Add();
                    col.Field("Freight").HeaderText("Freight").Format("{0:c}").TextAlign(TextAlign.Right).Width(90).Add();
                    col.Field("ShipCity").HeaderText("Ship City").Width(90).Add();
                    col.Field("Child.Test").HeaderText("TEst").Format("{0:c}").Width(90).Add();
                    col.Field("ShipCountry").HeaderText("Ship Country").Width(90).Add();
                    })
                    )

                    <script>
                    var obj = $("#Grid").ejGrid("instance");
                    var value = $("#colValue").val();
                    //Add custom parameter to the server
                    var query = new ej.Query().addParams("EmployeeID", value);
                    //Creating ejDataManager with UrlAdaptor
                    var dataManager = ej.DataManager({ url: "/Home/GetData", adaptor: new ej.UrlAdaptor() });
                    var promise = dataManager.executeQuery(query); promise.done(function (e) {
                    //Assign the result to the grid dataSource using "dataSource" method.
                    obj.dataSource(e.result);
                    </script>


                    To update the Grid, you can use dataSource() method. To call that method you need to take the Grid instance and call that method.



                    Refer the below API documentation for your reference



                    https://help.syncfusion.com/api/js/ejgrid#methods:datasource - used to update the Grid dataSource dynamically



                    https://help.syncfusion.com/api/js/ejgrid#members:datasource - returns the Grid dataSource.



                    Please get back to us if you have further queries.






                    share|improve this answer
























                    • Thanks vignesh vicky can you please point me out the documentation which specifically states what you have answered because i actually want to know where is it stated that using ejGrid("instance") will get me the current instance of grid. will mark you answer as correct once i have that reference.

                      – JayD
                      Nov 23 '18 at 14:03














                    0












                    0








                    0







                    In the Below code example Grid – Grid ID and you can take the Grid instance using the above code example. From the instance you can get the details regarding the column, dataSource, filterSettings, sortSettings etc currently applied to ejGrid. We have given support to customize the Grid using several public method. You can call those method by taking the Grid instance.



                    @(Html.EJ().Grid<EJGrid.Models.Order>("Grid")
                    .Datasource((IEnumerable<object>)ViewBag.datasource)
                    .AllowPaging()
                    .Columns(col =>
                    { col.Field("OrderID").HeaderText("Order ID").TextAlign(TextAlign.Right).Width(75).Add();
                    col.Field("EmployeeID").HeaderText("Employee ID").TextAlign(TextAlign.Right).Width(90).Add();
                    col.Field("Freight").HeaderText("Freight").Format("{0:c}").TextAlign(TextAlign.Right).Width(90).Add();
                    col.Field("ShipCity").HeaderText("Ship City").Width(90).Add();
                    col.Field("Child.Test").HeaderText("TEst").Format("{0:c}").Width(90).Add();
                    col.Field("ShipCountry").HeaderText("Ship Country").Width(90).Add();
                    })
                    )

                    <script>
                    var obj = $("#Grid").ejGrid("instance");
                    var value = $("#colValue").val();
                    //Add custom parameter to the server
                    var query = new ej.Query().addParams("EmployeeID", value);
                    //Creating ejDataManager with UrlAdaptor
                    var dataManager = ej.DataManager({ url: "/Home/GetData", adaptor: new ej.UrlAdaptor() });
                    var promise = dataManager.executeQuery(query); promise.done(function (e) {
                    //Assign the result to the grid dataSource using "dataSource" method.
                    obj.dataSource(e.result);
                    </script>


                    To update the Grid, you can use dataSource() method. To call that method you need to take the Grid instance and call that method.



                    Refer the below API documentation for your reference



                    https://help.syncfusion.com/api/js/ejgrid#methods:datasource - used to update the Grid dataSource dynamically



                    https://help.syncfusion.com/api/js/ejgrid#members:datasource - returns the Grid dataSource.



                    Please get back to us if you have further queries.






                    share|improve this answer













                    In the Below code example Grid – Grid ID and you can take the Grid instance using the above code example. From the instance you can get the details regarding the column, dataSource, filterSettings, sortSettings etc currently applied to ejGrid. We have given support to customize the Grid using several public method. You can call those method by taking the Grid instance.



                    @(Html.EJ().Grid<EJGrid.Models.Order>("Grid")
                    .Datasource((IEnumerable<object>)ViewBag.datasource)
                    .AllowPaging()
                    .Columns(col =>
                    { col.Field("OrderID").HeaderText("Order ID").TextAlign(TextAlign.Right).Width(75).Add();
                    col.Field("EmployeeID").HeaderText("Employee ID").TextAlign(TextAlign.Right).Width(90).Add();
                    col.Field("Freight").HeaderText("Freight").Format("{0:c}").TextAlign(TextAlign.Right).Width(90).Add();
                    col.Field("ShipCity").HeaderText("Ship City").Width(90).Add();
                    col.Field("Child.Test").HeaderText("TEst").Format("{0:c}").Width(90).Add();
                    col.Field("ShipCountry").HeaderText("Ship Country").Width(90).Add();
                    })
                    )

                    <script>
                    var obj = $("#Grid").ejGrid("instance");
                    var value = $("#colValue").val();
                    //Add custom parameter to the server
                    var query = new ej.Query().addParams("EmployeeID", value);
                    //Creating ejDataManager with UrlAdaptor
                    var dataManager = ej.DataManager({ url: "/Home/GetData", adaptor: new ej.UrlAdaptor() });
                    var promise = dataManager.executeQuery(query); promise.done(function (e) {
                    //Assign the result to the grid dataSource using "dataSource" method.
                    obj.dataSource(e.result);
                    </script>


                    To update the Grid, you can use dataSource() method. To call that method you need to take the Grid instance and call that method.



                    Refer the below API documentation for your reference



                    https://help.syncfusion.com/api/js/ejgrid#methods:datasource - used to update the Grid dataSource dynamically



                    https://help.syncfusion.com/api/js/ejgrid#members:datasource - returns the Grid dataSource.



                    Please get back to us if you have further queries.







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Nov 23 '18 at 9:42









                    vignesh vickyvignesh vicky

                    661




                    661













                    • Thanks vignesh vicky can you please point me out the documentation which specifically states what you have answered because i actually want to know where is it stated that using ejGrid("instance") will get me the current instance of grid. will mark you answer as correct once i have that reference.

                      – JayD
                      Nov 23 '18 at 14:03



















                    • Thanks vignesh vicky can you please point me out the documentation which specifically states what you have answered because i actually want to know where is it stated that using ejGrid("instance") will get me the current instance of grid. will mark you answer as correct once i have that reference.

                      – JayD
                      Nov 23 '18 at 14:03

















                    Thanks vignesh vicky can you please point me out the documentation which specifically states what you have answered because i actually want to know where is it stated that using ejGrid("instance") will get me the current instance of grid. will mark you answer as correct once i have that reference.

                    – JayD
                    Nov 23 '18 at 14:03





                    Thanks vignesh vicky can you please point me out the documentation which specifically states what you have answered because i actually want to know where is it stated that using ejGrid("instance") will get me the current instance of grid. will mark you answer as correct once i have that reference.

                    – JayD
                    Nov 23 '18 at 14:03


















                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53432856%2fsyncfusion-ej-grid-javascript-method%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    If I really need a card on my start hand, how many mulligans make sense? [duplicate]

                    Alcedinidae

                    Can an atomic nucleus contain both particles and antiparticles? [duplicate]