This is a migrated thread and some comments may be shown as answers.

[Solved] Empty grid will send a ajax request automatically?

5 Answers 106 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
FENG Zhichao
Top achievements
Rank 1
FENG Zhichao asked on 12 Dec 2009, 05:47 PM
I make a grid binding data on server side and make it can be refreshed by ajax request in client side.
if the server side data is empty, it seems the grid will send a ajax request automatically.
So the user can see a refresh on the page.
Is this right or i can do some config to avoid the automatic ajax refresh?
Thanks~~

5 Answers, 1 is accepted

Sort by
0
Accepted
Atanas Korchev
Telerik team
answered on 14 Dec 2009, 08:52 AM
Hello FENG Zhichao,

 Indeed the grid makes an ajax request initially when empty and ajax is enabled. You can modify the source of the grid in order to avoid that. To do so find this method and delete the highlighted section:

$.fn.tGrid = function(options) {
        options = $.extend({}, $.fn.tGrid.defaults, options);

        return this.each(function() {
            options = $.meta ? $.extend({}, options, $(this).data()) : options;

            if (!$(this).data('tGrid')) {
                var grid = new $t.grid(this, options);

                $(this).data('tGrid', grid);

                if (grid.$tbody.find('tr.t-no-data').length)
                    grid.ajaxRequest();
            }
        });
    }


Regards,
Atanas Korchev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
FENG Zhichao
Top achievements
Rank 1
answered on 14 Dec 2009, 01:20 PM
thanks ~~~
0
Alexandre Jobin
Top achievements
Rank 1
answered on 13 Apr 2011, 07:34 PM
i presently use the version 2011.1.315 of the grid. I have the very same problem as described by Feng. Is it possible for you to check if the data as been initlized server sided and if yes, do not fire an Ajax call if the grid is empty. I think its an easy one that would solve a few problems on my side.

thank you very much!

alex
0
Alexandre Jobin
Top achievements
Rank 1
answered on 28 Apr 2011, 03:44 PM
any news on this one? will you make the correction in your code for a future release?

alex
0
Atanas Korchev
Telerik team
answered on 28 Apr 2011, 03:55 PM
Hi Alexandre Jobin,

 We will not change this behavior because quite a lot of people rely on it. Use the workaround mentioned before.

Regards,
Atanas Korchev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Grid
Asked by
FENG Zhichao
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
FENG Zhichao
Top achievements
Rank 1
Alexandre Jobin
Top achievements
Rank 1
Share this question
or