This is a migrated thread and some comments may be shown as answers.

Switcing to Kendo UI from Telerik Missing orderBy and filterBy

1 Answer 30 Views
Grid
This is a migrated thread and some comments may be shown as answers.
JOHN
Top achievements
Rank 1
JOHN asked on 16 Oct 2013, 07:57 PM
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);
    }

1 Answer, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 17 Oct 2013, 07:09 AM
Hi John,

 You can check the updated export to excel code library project and use the code from it in your project.

Regards,
Atanas Korchev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Grid
Asked by
JOHN
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Share this question
or