Quantcast
Channel: Telerik Forums RSS
Viewing all articles
Browse latest Browse all 84751

PDF Export Issues

$
0
0

I pulled the files from the original kendo installation folder and that seem to fix the PDF, but for Excel, I now have a issue where it will only print when the grid is grouped.  Here is the code that will show you the issue - I have a button that toggles the grouping pane when clicked - also, I found I had to manually adjust the grid.content because when redrawn with the grouping pane hidden it left a blank space at the bottom the height of the grouping pane.  Perhaps there is a better way to hide/show the grouping pane.  I have to conserve vertical space in my app, so I don't want it visible when users don't want to group.

 

Here is an example - if you click the group button, you will find you can no longer export...

<!DOCTYPE html>
<html>
<head>
    <metacharset="utf-8">
    <title>Kendo UI Snippet</title>
 
 
    <scriptsrc="http://code.jquery.com/jquery-1.9.1.min.js"></script>
</head>
<body>
   
    <divid="grid"></div>
    <script>
        $("#grid").kendoGrid({
            toolbar: ["excel"],
            excel: {
                fileName: "Kendo UI Grid Export.xlsx"
            },
            dataSource: {
                type: "odata",
                transport: {
                    read: "http://demos.telerik.com/kendo-ui/service/Northwind.svc/Products"
                },
                pageSize: 7,
                group : { field :"ProductName"}
            },
            groupable: true,
            sortable: true,
            pageable: true,
            height : 300,
            columns: [
                { width: 300, field: "ProductName", title: "Product Name" },
                { field: "UnitsOnOrder", title: "Units On Order" },
                { field: "UnitsInStock", title: "Units In Stock" }
            ]
        });
       
 function groupClick(gridName) {
 
    var grid = $(gridName).data("kendoGrid");
    var _gridName = gridName.replace('#', '');
 
    grid.groupable = !grid.groupable;
 
 
    // record the height of both so we can adjust because the grid won't fill the content div
    var groupHeight = $(gridName + " .k-grouping-header").outerHeight();
    var contentHeight = grid.content.outerHeight();
 
    if (grid.groupable) {
        $("#toolbar-group-" + _gridName).addClass('k-state-active');
        $(gridName + " .k-grouping-header").css('display', 'block');
 
        // adjust content size
        grid.content.css('height', contentHeight - groupHeight);
 
    }
    else {
        grid.dataSource.group("");
        $("#toolbar-group-" + _gridName).removeClass('k-state-active');
        $(gridName + " .k-grouping-header").css('display', 'none');
 
        // adjust content size
        grid.content.css('height', contentHeight + groupHeight);
 
        if (_gridName == 'grid') gridHeight = contentHeight + groupHeight;
    }
 
    grid.content.scrollTop(0);
 
    return false;
};
    </script>
      <buttononclick="groupClick('#grid');">Group</button>
</body>
</html>

Viewing all articles
Browse latest Browse all 84751

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>