We are converting an app from Telerik MVC to Kendo UI. We have jQuery code on our grids to capture the current orderBy and filterBy parameters so we can pass them back to our controller. The controller then creates an Excel download using those parameters.
However the orderBy and filterBy are now undefined in Kendo. How do I retrieve those values?
function onDataBound() {
$('a.lnkDeal').each(function () {
this.href = this.href.replace(/&/g, "%26");
});
var grid = $("#Deals").data('kendoGrid');
// Get the export link as jQuery object
var $exportLink = $('#ExportToExcel');
// Get its 'href' attribute - the URL where it would navigate to
var href = $exportLink.attr('href');
// Update the 'orderBy' parameter with the grids' current sort state
href = href.replace(/orderBy=([^&]*)/, 'orderBy=' + (grid.orderBy || '~'));
// Update the 'filter' parameter with the grids' current filtering state
//href = href.replace(/filter=(.*)/, 'filter=' + (grid.filterBy || '~'));
// Update the 'href' attribute. Replace all ' with | to avoid security issue
href = href.replace(/'/g, "|");
$exportLink.attr('href', href);
}
However the orderBy and filterBy are now undefined in Kendo. How do I retrieve those values?
function onDataBound() {
$('a.lnkDeal').each(function () {
this.href = this.href.replace(/&/g, "%26");
});
var grid = $("#Deals").data('kendoGrid');
// Get the export link as jQuery object
var $exportLink = $('#ExportToExcel');
// Get its 'href' attribute - the URL where it would navigate to
var href = $exportLink.attr('href');
// Update the 'orderBy' parameter with the grids' current sort state
href = href.replace(/orderBy=([^&]*)/, 'orderBy=' + (grid.orderBy || '~'));
// Update the 'filter' parameter with the grids' current filtering state
//href = href.replace(/filter=(.*)/, 'filter=' + (grid.filterBy || '~'));
// Update the 'href' attribute. Replace all ' with | to avoid security issue
href = href.replace(/'/g, "|");
$exportLink.attr('href', href);
}