javascript - 从 Telerik 切换到 Kendo UI 缺少​​ orderBy 和 filter By

标签 javascript jquery user-interface kendo-ui

我们正在将一个应用程序从 Telerik MVC 转换为 Kendo UI。我们的网格上有 jQuery 代码来捕获当前的 orderBy 和 filterBy 参数,这样我们就可以将它们传回我们的 Controller 。然后 Controller 使用这些参数创建 Excel 下载。

但是 orderBy 和 filterBy 现在在 Kendo 中是未定义的。我如何检索这些值?

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);
}

最佳答案

检查 filter定义为对象和 sort在 DataSource 中过滤和排序结果。

将这两个选项与serverSorting结合起来和 serverFiltering用于向服务器发送排序和过滤参数。

关于javascript - 从 Telerik 切换到 Kendo UI 缺少​​ orderBy 和 filter By,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19361662/

相关文章:

javascript - jquery中获取siblingNode值

user-interface - 用户界面如何知道允许对聚合根执行哪些命令?

python - 如何控制 tkinter 按钮小部件上图像和文本之间的空间?

javascript - 遍历 div 子项和粗体特定文本不起作用

javascript - 调试时更改 JavaScript 版本

javascript - 如何在 Polymer 中设置 url 变化的观察者?

javascript - 无法点击关闭 AngularJS 中的 Accordion

PHP 数组转换为 Json 并将数据恢复到网页中

javascript - 空格键在表单字段中不起作用

媲美WPF的Linux开源2d GUI引擎