アプリを Telerik MVC から Kendo UI に変換しています。現在の orderBy および filterBy パラメーターを取得するための jQuery コードがグリッドにあり、それらをコントローラーに戻すことができます。次に、コントローラーは、これらのパラメーターを使用して Excel ダウンロードを作成します。
ただし、剣道では orderBy と filterBy が未定義になりました。これらの値を取得するにはどうすればよいですか?
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);
}