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

TreeGrid load data by webmethods

Hello,

I have a question about TreeGrid control:

How to load the data by webmethod like the Grid control with the WebMethodAdaptor?

Thanks!



9 Replies

JR John Rajaram Syncfusion Team November 12, 2015 01:10 PM UTC

Hi Jorge,
Thanks for using Syncfusion products.
At present there is no support for WebMethodAdapter in TreeGrid control. For this we have already logged a feature request regarding this.
A support incident has been created under your account to track the status of this requirement. Please log on to our support website to check for further updates.

But we can load the data to TreeGrid control from web method through ejDataManager control with the help of following code snippets.
Code snippets:

//...
<ej:TreeGrid runat="server" ID="TreeGridControlEditing" TreeColumnIndex="1" 
            EnableResize="true" IdMapping="TaskId" ParentIdMapping="ParentId" Load="Load">            
          <columns>
                <ej:TreeGridColumn HeaderText="Task Id" Field="TaskId" Width="55" EditType="Numeric"/>
                <ej:TreeGridColumn HeaderText="Task Name" Field="TaskName" EditType="String"/>
                <ej:TreeGridColumn HeaderText="Start Date" Field="StartDate" EditType="Datepicker"/>
                <ej:TreeGridColumn HeaderText="End Date" Field="EndDate" EditType="Datepicker"/>
                <ej:TreeGridColumn HeaderText="Duration" Field="Duration" EditType="Numeric" />
                <ej:TreeGridColumn HeaderText="Progress" Field="Progress" EditType="Numeric"/>
         </columns> 

    //...

</ej:TreeGrid>
          <script>
              function Load() {
                  var data = ej.DataManager({ url: "http://mvc.syncfusion.com/ProjectDataService/ProjectDataService.svc/ProjectDatas"});
                  var obj = $("#TreeGridControlEditing").data("ejTreeGrid");
                  obj.model.dataSource = data;
              }
          </script>

//...


Please let us know if you require further assistance on this.
Regards,
John R



JP Jorge Pampin November 12, 2015 03:50 PM UTC

Ok, thank you! It's enough.


DK Dinesh Kumar Nagarathinam Syncfusion Team November 13, 2015 12:10 PM UTC

Hi Jorge,

Thanks for the update.

Please let us know, if you require any further assistance on this.


Regards,

Dinesh kumar.N



JP Jorge Pampin November 18, 2015 05:12 PM UTC

Hello,

Now, I need to bind the gridtree control with json data clicking on a button, how to do this?

Thanks!


DK Dinesh Kumar Nagarathinam Syncfusion Team November 19, 2015 03:19 PM UTC

Hi Jorge,
We can bind a json data source while clicking on a button, we have prepared a sample based on your requirement, find the sample from below location.
Sample: http://www.syncfusion.com/downloads/support/forum/121095/ze/TreeGridSample_JSON-885380002
Please let us know, if you need further assistance on this.
Regards,
Dinesh kumar.N


JP Jorge Pampin November 19, 2015 04:13 PM UTC

Hello,

It works, but if I want to load a lot of row, it gives an "not enough stack space" error.

Thanks!


DK Dinesh Kumar Nagarathinam Syncfusion Team November 20, 2015 08:50 AM UTC

Hi Jorge,

We suggest you to increase the maxJsonLength  of jsonSerialization in your web.config file.

Code Snippet:

[Web.Config]

<configuration>

<system.web.extensions>

        <scripting>

            <webServices>

                <jsonSerialization maxJsonLength="90000000" />

            </webServices>

        </scripting>

    </system.web.extensions>

</configuration>



We have prepared a sample based on your requirement, in that we have binded about 6000 Json data. Find the sample from below location.

Sample: http://www.syncfusion.com/downloads/support/forum/121095/ze/TreeGrid_with_large_data-1840095248

Regards,

Dinesh kumar.N



JP Jorge Pampin November 20, 2015 09:16 AM UTC

Hello,

That is no the problem because this is my web.config configuration:

<system.web.extensions>
    <scripting>
      <webServices>
        <jsonSerialization maxJsonLength="2147483644"/>
      </webServices>
    </scripting>
  </system.web.extensions>

The exception is thrown in this line: treegridObj.option("dataSource", data);

Thanks!



DK Dinesh Kumar Nagarathinam Syncfusion Team November 23, 2015 12:40 PM UTC

Hi Jorge,

We are unable to reproduce the reported issue, we have prepared a sample with 10000 records, can you please revert us by modifying the attached sample with your reported issue? This would be helpful for us to serve you. Find the sample from below location.

Sample: http://www.syncfusion.com/downloads/support/forum/121095/ze/JSON_from_web_metod400368143

Regards,

Dinesh kumar.N


Loader.
Up arrow icon