155 lines
5.3 KiB
Text
155 lines
5.3 KiB
Text
@using Kreta.Resources
|
|
|
|
@{
|
|
var exportFileName = ViewData[GRModulResource.IntezmenyAzonositoKey] + "-targyieszkozok.xlsx";
|
|
}
|
|
|
|
<style>
|
|
.KretaJsGrid .k-filtercell > span > .k-button {
|
|
padding-left: 0;
|
|
padding-right: 0;
|
|
}
|
|
|
|
.KretaJsGrid .k-pager-wrap .k-pager-nav span {
|
|
margin-top: -5px;
|
|
}
|
|
|
|
a.k-button.k-button-icontext.k-grid-excel {
|
|
display: none !important;
|
|
}
|
|
</style>
|
|
<a class="k-button k-button-icontext" href="#" onclick="TargyiEszkozokHelper.exportData()">@GRModulResource.ExportalasExcelben</a>
|
|
<div class="KretaJsGrid" id="targyiEszkozokGrid"></div>
|
|
|
|
@section AddJs{
|
|
<script type="text/javascript">
|
|
var TargyiEszkozokHelper = (function () {
|
|
var helper = function () { };
|
|
const gridId = "targyiEszkozokGrid";
|
|
let grid;
|
|
|
|
const urls = {
|
|
GetTargyiEszkozok: "@Url.HttpRouteUrl(Constants.RouteKey.ActionApi, new { controller = "TargyiEszkozokApi", action = "Get" })",
|
|
}
|
|
|
|
helper.exportData = () => {
|
|
exportData();
|
|
}
|
|
|
|
helper.refreshGrid = function () {
|
|
AjaxHelper.DoGet(urls.GetTargyiEszkozok, {}, setGridData);
|
|
}
|
|
|
|
helper.export = () => {
|
|
KretaGridHelper.exportGrid(grid, 'TargyiEszkozok', ['EszkozMegnevezes', 'EszkozGyariSzam', 'EszkozLeltarszam','AlkalmazottNev' ], null, false, false);
|
|
};
|
|
|
|
function initGrid(){
|
|
grid = $("#"+gridId).kendoGrid({
|
|
columns: [
|
|
{
|
|
field: "EszkozMegnevezes",
|
|
title: "@Html.Raw(GRModulResource.EszkozMegnevezese)",
|
|
filterable: {
|
|
cell: {
|
|
operator: "contains",
|
|
suggestionOperator: "contains",
|
|
showOperators: false
|
|
}
|
|
},
|
|
headerAttributes: { style: "text-align: center; vertical-align: top;" }
|
|
},
|
|
{
|
|
field: "EszkozMuszakicsoportkodNev",
|
|
title: "@Html.Raw(GRModulResource.EszkozTipusa)",
|
|
filterable: {
|
|
cell: {
|
|
operator: "contains",
|
|
suggestionOperator: "contains",
|
|
showOperators: false
|
|
}
|
|
},
|
|
headerAttributes: { style: "text-align: center; vertical-align: top;" },
|
|
|
|
},
|
|
{
|
|
field: "EszkozGyariSzam",
|
|
title: "@Html.Raw(GRModulResource.GyariSzama)",
|
|
filterable: {
|
|
cell: {
|
|
operator: "contains",
|
|
suggestionOperator: "contains",
|
|
showOperators: false
|
|
}
|
|
},
|
|
headerAttributes: { style: "text-align: center; vertical-align: top;" },
|
|
|
|
},
|
|
{
|
|
field: "EszkozLeltarszam",
|
|
title: "@Html.Raw(GRModulResource.LeltáriSzama)",
|
|
filterable: {
|
|
cell: {
|
|
operator: "contains",
|
|
suggestionOperator: "contains",
|
|
showOperators: false
|
|
}
|
|
},
|
|
headerAttributes: { style: "text-align: center; vertical-align: top;" },
|
|
},
|
|
{
|
|
field: "AlkalmazottNev",
|
|
title: "@Html.Raw(GRModulResource.FelelosSzemely)",
|
|
filterable: {
|
|
cell: {
|
|
operator: "contains",
|
|
suggestionOperator: "contains",
|
|
showOperators: false
|
|
}
|
|
},
|
|
headerAttributes: { style: "text-align: center; vertical-align: top;" },
|
|
}
|
|
],
|
|
filterable: {
|
|
mode: "row"
|
|
},
|
|
pageable: true,
|
|
sortable: {
|
|
mode: "multiple",
|
|
allowUnsort: true,
|
|
},
|
|
toolbar: ["excel"],
|
|
excel: {
|
|
fileName: '@exportFileName',
|
|
filterable: true,
|
|
allPages: true
|
|
}
|
|
});
|
|
};
|
|
|
|
function setGridData(data) {
|
|
const dataSource = new kendo.data.DataSource({
|
|
data: data.Data,
|
|
pageSize: 100,
|
|
});
|
|
|
|
$("#" + gridId).data("kendoGrid").setDataSource(dataSource);
|
|
}
|
|
|
|
function exportData() {
|
|
let grid = $("#" + gridId).data("kendo-grid");
|
|
|
|
if (grid) {
|
|
grid.saveAsExcel();
|
|
}
|
|
}
|
|
|
|
initGrid();
|
|
|
|
helper.refreshGrid();
|
|
|
|
return helper;
|
|
})();
|
|
</script>
|
|
}
|
|
|