1

アプリを 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);
}
4

2 に答える 2

2

結果のフィルタリングと並べ替えのためにfilter、オブジェクトとして定義され、DataSource で定義されていることを確認します。sort

これらの 2 つのオプションを組み合わせて、ソートserverSortingおよびserverFilteringフィルタリング パラメータをサーバーに送信します。

于 2013-10-14T15:09:24.013 に答える
0

@OnaBai の回答に加えて、移行のヘルプ トピックを確認できます: http ://docs.kendoui.c​​om/getting-started/using-kendo-with/aspnet-mvc/migration/widgets/grid#client-side-api

于 2013-10-15T15:45:04.993 に答える