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

Loading Grid through an ajax request after inital page load.

Here is my scenario:

1. I load up an initial page that contains no syncfusion elements in it.  It seems like when if I call @{Html.Syncfusion().ScriptManager().Render();} on that initial page load, it doesn't really load anything because I haven't used any components at that point.

2. I have a link on the page that will dynamically load another view with a Syncfusion Grid built in.  Since that grid was not in the initial page load, it seems I am missing several javascript elements to render it.

So my question is:  Is there a way to dynamically load all of the elements I need for that grid either
  • When I load the second page via AJAX with the grid on it (preferable, since a user might only load this page 10% of the time)
  • When I load the initial page that doesn't have Syncfusion components on it.

I am using jQuery Mobile for the switching between pages, even though this is primarily a desktop application.

Thanks so much for any info you can provide!

 - Chris



5 Replies

RD Rakesh D Syncfusion Team February 27, 2013 07:32 PM UTC

Hi Chris,

 

Thank you for using Syncfusion products.

 

Query : Loading grid through ajax request after page load?’

 

To achieve your requirement we suggest you to use $.ajax to load the grid after page load. While using Ajax post scripts will not be evaluated.  To overcome this use $.fn.sfEvalScripts(data) function in success action. Please refer below code snippet for further details.

 

<script type="text/javascript">

$.ajax({

                type: "GET",

                url: "ServerMode",

                data: "",

                datatype: "html",

                success: function (data) {

                    $("#Target")[0].innerHTML = data;

                    $.fn.sfEvalScripts(data);

                }

            });

</script>

 

 

For your convenience we have prepared a sample for the above scenario and it is attached below. Please refer to it.

 

Please let us know if you have any concerns.

 

Regards,

Rakesh D

 

 



AjaxLoad_791687aa.zip


JT John Tafoya May 9, 2013 03:32 AM UTC

I've tried on two separate computers to get the sample to run but I can't get it to work. After rebuilding a project from scratch I was able to get past the build errors (version stuff with the SF references), and I finally got the callback to get called.

But the table is display:none and I'm unclear what client-side callbacks are being made.

Is there any clear, accurate documentation that covers async/ajax loading of data into a grid?


RD Rakesh D Syncfusion Team May 15, 2013 01:24 PM UTC

 Hi John,

 

We regret for the inconvenience caused.

 

Could you please provide us the Essential Studio Version you using at your end ? So that we can modify the sample and provide it in the Essential Studio Version you are using.

 

Please refer below our online documentation for “How to avoid Grid Invisibility”.

 

http://help.syncfusion.com/ug/asp.net%20mvc/grid/default.htm#!documents/520howtoavoidgridinvisibility.htm

 

 

Please let us know if you have any concerns.

 

Regards,

Rakesh D

 



JT John Tafoya September 25, 2013 11:50 PM UTC

Your link is broken...


AR Ajith R Syncfusion Team September 27, 2013 05:25 AM UTC

Hi John,

 

We are sorry for the inconvenience caused.

 

Please refer the below link instead of our  previous update.

 

http://help.syncfusion.com/ug/asp.net%20mvc/grid/default.htm#!documents/howtoavoidgridinvisi.htm

 

Please let us know if you need any further assistance.

 

Regards,

 

Ajith R


Loader.
Live Chat Icon For mobile
Up arrow icon