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

Telerik grid vs. kendo grid and Ajax calls

2 Answers 27 Views
Let's talk about telerik (the good and the bad)
This is a migrated thread and some comments may be shown as answers.
littleGreenDude
Top achievements
Rank 1
littleGreenDude asked on 05 Feb 2014, 08:11 PM
We migrated from the original Telerik grid to Kendo, and we are seeing redundant ajax calls.

We had code that previously implemented the telerik grid

 

@(Html.Telerik().Grid()<myTransactions>
.Name("Transactions")
.ClientEvents(events => events.OnLoad("TransactionsGrid_onLoad"))
.ClientEvents(events => events.OnDataBound("TransactionsGrid_onDataBound"))
.DataBinding(dataBinding => dataBinding
.Ajax()
.OperationMode(GridOperationMode.Client)
.Select("TransactionsAjax", controller))
 

We have recently migrated to Telerik's Kendo grid, and changed the code to the following:

 

@(Html.Kendo().Grid<myTransactions>()
.Name("Transactions")
.AutoBind(true)
.Events(events => events.DataBound("TransactionsGrid_onDataBound"))
.DataSource(dataSource => dataSource
.Ajax()
.ServerOperation(false)
.Read(read => read.Action("TransactionsAjax", controller))
.PageSize(15))

 

In addition to the grid, the page has 3 other fields; a combobox and 2
date fields that filter the grid. The filtering works fine.

 

However, the printer friendly button calls TransactionsAjax for the
Kendo grid and removes all filtering that was applied. The original
Telerik just rendered the existing grid as print friendly without making
a redundant call to TransactionsAjax.

 

Since the desired data to be printed is already filtered and available
on the screen there is no reason to repeat the call. Is there some grid
configuration setting I am missing that would stop the undesired call
from happening?

2 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 07 Feb 2014, 01:51 PM
Hello,

We will need additional information about your implementation. Could you please show us the code executed when the print button is clicked? We need the old code that worked and the new one. 

Regards,
Atanas Korchev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
littleGreenDude
Top achievements
Rank 1
answered on 07 Feb 2014, 02:04 PM
Thank you for the feedback.  I've worked around the issue.   Something about the first line of javascript in our printer friendly function causes the Ajax call to occur with the Kendo grid where it didn't cause it with the original Telerik grid.  Changed javascript function to use jQuery clone and things are working now.

Old code:

function ShowPrinterFriendly() {
    $("#printerFriendlyContent").html($("#mainContent").html());

New code:

function ShowPrinterFriendly() {

var $originalDiv = $("#mainContent");
var $clonedDiv = $originalDiv.clone();

//get original selects
var $originalSelects = $originalDiv.find("select");

//for all cloned selection objects
$clonedDiv.find("select").each(function(index, item) {
//set new select to value of old select
$(item).val($originalSelects.eq(index).val());
});
$clonedDiv.appendTo("#printerFriendlyContent");

 
Tags
Let's talk about telerik (the good and the bad)
Asked by
littleGreenDude
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
littleGreenDude
Top achievements
Rank 1
Share this question
or