syncfusion ej grid javascript method











up vote
1
down vote

favorite












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




























    up vote
    1
    down vote

    favorite












    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


























      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      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 at 17:27









      DavOS

      6481621




      6481621










      asked Nov 22 at 14:13









      JayD

      186




      186
























          2 Answers
          2






          active

          oldest

          votes

















          up vote
          0
          down vote













          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




























            up vote
            0
            down vote













            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 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',
            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








            up vote
            0
            down vote













            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

























              up vote
              0
              down vote













              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























                up vote
                0
                down vote










                up vote
                0
                down vote









                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 at 22:07









                Ronald Walcott

                1




                1
























                    up vote
                    0
                    down vote













                    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 at 14:03















                    up vote
                    0
                    down vote













                    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 at 14:03













                    up vote
                    0
                    down vote










                    up vote
                    0
                    down vote









                    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 at 9:42









                    vignesh vicky

                    411




                    411












                    • 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 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 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 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 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.





                    Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                    Please pay close attention to the following guidance:


                    • 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

                    Trompette piccolo

                    Slow SSRS Report in dynamic grouping and multiple parameters

                    Simon Yates (cyclisme)