با سلام
من در گرید Kendo که طبق کد زیر تعریف کرده ام وقتی بر روی Export Excel کلیک می کنم هیچ عکس العملی نشان داده نمی شود لطفا راهنمای فرمایید
و مشکل دوم اینکه هنگامی که تعداد فیلد ها زیاد باشد و بایستی Scroll به چپ انجام دهیم هدر مربوط به گروهبندی و Export excel در تمامی Grid Scroll شده نمایش داده نمی شود
طبق عکس زیر
با سپاس
=-==-=-=-==-=-=-==-=-View =-==-=-=-==-=-=-==-=-=-
@model Spec.UI.Models.Temp
@{
Layout = MVC.Shared.Views._AMain;
ViewBag.Title = "گزارش ";
}
<form action="" method="post" id="ReportFilter">
<div class="k-rtl" style="margin-bottom:20px">
<div id="report-grid" style="overflow : auto;"></div>
</div>
<button type="submit" id="Search" class="btn btn-primary block btnstyle pull-left">جستجو</button>
</form>
<script src="~/Content/Admin/Scripts/plugins/kendo/kendo.all.min.js"></script>
<script src="~/Content/Admin/Scripts/kendo/kendo.all.min.intellisense.js"></script>
<script src="~/Content/Admin/Scripts/plugins/kendo/jszip.min.js"></script>
<script src="~/Scripts/kendo.fa-IR.js" type="text/javascript"></script>
@Scripts.Render("~/admin/blockUI/script")
<script type="text/javascript">
var DataSource;
var grid;
kendo.culture("fa-IR");
$(document).ready(function () {
$("#ReportFilter").submit(function (event) {
$.blockUI(
{
message: '<h1> لطفا صبر نمایید . . . <img src="../Content/Admin/Images/General/loading_2x.gif" /> </h1>'
});
$.ajax({
url: "@Url.Action("ActionName", "ControllerName")",
dataType: 'json',
//data: $('#ReportFilter').serialize() ,
type: 'POST',
success: function (result) {
grid = $("#report-grid").data("kendoGrid");
DataSource = new kendo.data.DataSource({
data: result.Data
,
error: function (e) {
alert(e.errorThrown);
},
pageSize: 10,
sortable: true,
groupable: true,
resizable: true,
reorderable: true
});
grid.setDataSource(DataSource);
grid.dataSource.read();
$.unblockUI();
},
error: function (xhr) {
alert(xhr.statusText);
}
});
event.preventDefault();
});
grid = $("#report-grid").kendoGrid({
toolbar: ["excel"],
//excel: {
// fileName: "Kendo UI Grid Export.xlsx",
// proxyURL: '/ControllerName/ActionName' ,
// allPages: true,
//},
//excelExport: function(e) {
// alert("Excel");
// // Prevent the default behavior which will prompt the user to save the generated file.
// e.preventDefault();
// // Get the Excel file as a data URL.
// var dataURL = new kendo.ooxml.Workbook(e.workbook).toDataURL();
// // Strip the data URL prologue.
// var base64 = dataURL.split(";base64,")[1];
// // Post the base64 encoded content to the server which can save it.
// $.post( "/ControllerName/ActionName", {
// //$.post("/Indent/Excel_Export_Save", {
// base64: base64,
// fileName: "ExcelExport.xlsx"
// });
//},
dataSource: DataSource,
selectable: "row",
allowCopy: true,
autoBind: true,
scrollable: false,
sortable: true,
groupable: true,
resizable: true,
reorderable: true,
filterable: true,
pageable: {
previousNext: true, // default true
numeric: true, // default true
buttonCount: 10, // default 10
refresh: true, // default false
input: true, // default false
pageSizes: true // default false
},
columns: [
{ field: "ID", title: "کد" },
{ field: "TITLE", title: "عنوان" }]
});
});
</script>
=-==-=-=-==-=-=-==-=-Controller Action =-==-=-=-==-=-=-==-=-
public virtual ActionResult Excel_Export_Save(string contentType, string base64, string fileName)
{
var fileContents = Convert.FromBase64String(base64);
return File(fileContents, contentType, fileName);
}