Javascript 从Telerik切换到剑道UI缺少orderBy和filterBy
我们正在将一个应用程序从Telerik MVC转换为剑道用户界面。我们的网格上有jQuery代码来捕获当前的orderBy和filterBy参数,以便我们可以将它们传递回控制器。然后,控制器使用这些参数创建Excel下载 但是,orderBy和filterBy现在在剑道中没有定义。如何检索这些值Javascript 从Telerik切换到剑道UI缺少orderBy和filterBy,javascript,jquery,user-interface,kendo-ui,Javascript,Jquery,User Interface,Kendo Ui,我们正在将一个应用程序从Telerik MVC转换为剑道用户界面。我们的网格上有jQuery代码来捕获当前的orderBy和filterBy参数,以便我们可以将它们传递回控制器。然后,控制器使用这些参数创建Excel下载 但是,orderBy和filterBy现在在剑道中没有定义。如何检索这些值 function onDataBound() { $('a.lnkDeal').each(function () { this.href = this.href.replace
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);
}
检查定义为对象和数据源中的筛选和排序结果
将这两个选项与和组合起来,用于向服务器发送排序和筛选参数。除了@OnaBai的答案外,您还可以查看迁移帮助主题: