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.
Unfortunately, activation email could not send to your email. Please try again.

Loading Grid through an ajax request after inital page load.

Thread ID:

Created:

Updated:

Platform:

Replies:

107286 Feb 22,2013 01:04 PM Sep 27,2013 01:25 AM ASP.NET MVC (Classic) 5
loading
Tags: Grid
Chris Neville
Asked On February 22, 2013 01:04 PM

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



Rakesh D [Syncfusion]
Replied On February 27, 2013 02:32 PM

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

John Tafoya
Replied On May 8, 2013 11:32 PM

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?

Rakesh D [Syncfusion]
Replied On May 15, 2013 09:24 AM

 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

 


John Tafoya
Replied On September 25, 2013 07:50 PM

Your link is broken...

Ajith R [Syncfusion]
Replied On September 27, 2013 01:25 AM

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


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;