Kendo UI网格使用模板值导出到Excel

我试图按照这个例子,但这不适合我。 我有:

function invoicedJobsGrid() { var invoicedJobsDS = new kendo.data.DataSource({ serverFiltering: true, serverSorting: true, serverPaging: true, pageSize: 25, requestEnd: function (e) { if (e.type == 'read') { $('.today-count').html(e.response.counts.today); $('.week-count').html(e.response.counts.week); $('.month-count').html(e.response.counts.month); // document.title = 'Invoiced jobs (' + (e.response.counts.currencies.GBP + e.response.counts.currencies.USD + e.response.counts.currencies.EUR) + ')'; } }, sort: { field: "invoice_id", dir: "desc" }, transport: { read: { url: 'invoiced-list', dataType: 'json', type: 'POST' } }, error: function (e) { alert(e.errorThrown + "\n" + e.status + "\n" + e.xhr.responseText); }, filter: [{ field: 'invoice_date', operator: 'gte', value: $('.month-count').parent().data('period') }], schema: { data: "data", total: 'total', model: { id: 'id', fields: { invoice_id: { type: 'number' }, entity_id: { type: 'number' }, job_id: { type: 'number' }, invoice_date: { type: 'date' }, invoiceDate: { type: 'date' }, jobType: { type: 'number' }, customer_name: { type: 'string' }, termId: { type: 'number' }, account_number: { type: 'string' }, firstName: { type: 'string' }, sales_area_id: { type: 'number' }, margin: { type: 'number' }, sales_total: { type: 'number' }, sales_total_gdp: { type: 'number' }, job_costs_value_pounds: { type: 'number' }, vat_native: { type: 'number' }, buying_parts_value_pounds: { type: 'number' }, buying_fees_value_pounds: { type: 'number' }, shipping_value_pounds: { type: 'number' }, symbol: { type: 'string' }, margin_percent: { type: 'number' }, zone_name: { type: 'string' }, zone_id: { type: 'number' }, buying_total: { type: 'number' }, emailed_date: { type: 'date' } } } }, aggregate: [ {field: "buying_total", aggregate: "sum"}, {field: "buying_total", aggregate: "average"}, {field: "shipping_value_pounds", aggregate: "sum"}, {field: "shipping_value_pounds", aggregate: "average"}, {field: "job_costs_value_pounds", aggregate: "sum"}, {field: "job_costs_value_pounds", aggregate: "average"}, {field: "buying_fees_value_pounds", aggregate: "sum"}, {field: "buying_fees_value_pounds", aggregate: "average"}, {field: "buying_parts_value_pounds", aggregate: "sum"}, {field: "buying_parts_value_pounds", aggregate: "average"}, {field: "sales_total", aggregate: "sum"}, {field: "sales_total", aggregate: "average"}, {field: "margin", aggregate: "sum"}, {field: "margin", aggregate: "average"}, {field: "sales_total_gdp", aggregate: "sum"}, {field: "sales_total_gdp", aggregate: "average"}, {field: "vat_native", aggregate: "sum"}, {field: "vat_native", aggregate: "average"}, ] }) var invoicedJobsGrid = $('#invoicedJobsGrid').kendoGrid({ toolbar: ["excel"], excel: { allPages: true }, excelExport: function(e) { var sheet = e.workbook.sheets[0]; var template = kendo.template(this.columns[6].template); for (var i = 1; i < sheet.rows.length; i++) { var row = sheet.rows[i]; var dataItem = { zone_name: row.cells[5].value }; row.cells[5].value = template(dataItem); console.log(row.cells[5]) } }, dataSource: invoicedJobsDS, autoBind: true, height: 680, editable: false, pageable: { pageSizes: [25, 50, 'All'], messages: { display: '{0} - {1} of {2} invoiced jobs', empty: 'There are no invoiced jobs', itemsPerPage: 'invoiced jobs per page' } }, dataBound: function (e) { var grid = e.sender; if (grid.dataSource.total() == 0) { var colCount = grid.columns.length; $(e.sender.wrapper) .find('.k-grid-content tbody') .append('<tr class="kendo-data-row no-results-row"><td colspan="' + colCount + '" class="no-data">No invoiced jobs for current filters</td></tr>'); } }, columns: [ { title: 'Account #', field: 'accountNumber', width: '100px', template: '#=accountNumber ? accountNumber : "<i class=\\"fa fa-pencil create-account-number\\"></i>"#' }, { title: 'Customer', field: 'name', template: '<a href="/laravel/entity/#=entity_id#" target="_blank">#=name#</a>' }, { title: 'Date', field: 'invoice_date', width: '85px', template: '<abbr title="#=kendo.toString(invoice_date, "dd/MM/yyyy at HH:mm")#">#=kendo.toString(invoice_date, "dd/MM/yyyy")#</abbr>' }, { title: 'Invoice', field: 'invoice_id', width: '80px', template: '<a href="/laravel/invoice/#=enquiry_id#" target="_blank">#=invoice_id#</a>' }, { title: 'Job', field: 'job_id', width: '65px', template: '<a href="/laravel/activity/#=enquiry_id#" target="_blank">#=job_id#</a>' }, { title: 'Trdr', headerTemplate: '<abbr title="Trader">Trdr</abbr>', field: 'traderId', width: '90px', template: '<abbr title="#=full_name#">#=trader#</abbr>', filterable: { ui: gridFunctions.traderFilterUI, extra: false } }, { title: 'Zone', field: 'zone_id', filterable: { ui: gridFunctions.zoneFilterUI, extra: false }, width: '120px', template: '#=zone_name#' }, { title: 'Sales (native)', headerTemplate: 'Sales <small>native</small>', field: 'sales_total_native', width: '110px', template: '#=symbol+kendo.toString(sales_total_native, "n2")#' }, { title: 'VAT', field: 'vat_native', filterable: false, sortable: false, width: '80px', template: '#=symbol+kendo.toString(vat_native, "n2")#', footerTemplate: '#: kendo.toString(sum, "n2") #<br /><span class="text-warning">#: kendo.toString(average, "n2") #</span>' }, { title: 'Total', field: 'sales_total', filterable: false, sortable: false, width: '100px', template: '#=symbol+kendo.toString(sales_total, "n2")#', footerTemplate: '#: kendo.toString(sum, "n2") #<br /><span class="text-warning">#: kendo.toString(average, "n2") #</span>' }, { title: 'Margin', field: 'margin', width: '100px', template: '<abbr title="#=kendo.toString(margin_percent, "p2")#">#=sales_symbol##=kendo.toString(margin, "n2")#</abbr>', footerTemplate: '£#: kendo.toString(sum, "n2") #<br /><span class="text-warning">£#: kendo.toString(average, "n2") #</span>' }, { title: 'VAT #', field: 'vatNumber', width: '110px', template: '#=vatNumber ? vatNumber : "<i class=\\"fa fa-pencil create-vat-number\\"></i>"#' }, { title: 'Total (£)', field: 'sales_total_gdp', width: '100px', template: '<abbr title="Using an exchange rate of: #=rate#">#=sales_symbol##=kendo.toString(sales_total_gdp, "n2")#</abbr>', footerTemplate: '#: kendo.toString(sum, "n2") #<br /><span class="text-warning">#: kendo.toString(average, "n2") #</span>' }, { title: 'Term', field: 'term_id', width: '90px', filterable: { ui: gridFunctions.paymentTermsFilterUI, extra: false }, template: '#=term#' }, { headerTemplate: 'Buying <small>parts</small>', field: 'buying_parts_value_pounds', width: '110px', template: '#=sales_symbol##=kendo.toString(buying_parts_value_pounds, "n2")#', footerTemplate: '#: kendo.toString(sum, "n2") #<br /><span class="text-warning">#: kendo.toString(average, "n2") #</span>' }, { headerTemplate: 'Buying <small>fees</small>', field: 'buying_fees_value_pounds', width: '100px', template: '#=sales_symbol##=kendo.toString(buying_fees_value_pounds, "n2")#', footerTemplate: '#: kendo.toString(sum, "n2") #<br /><span class="text-warning">#: kendo.toString(average, "n2") #</span>' }, { headerTemplate: 'Shipping', field: 'shipping_value_pounds', width: '90px', template: '#=sales_symbol##=kendo.toString(shipping_value_pounds, "n2")#', footerTemplate: '#: kendo.toString(sum, "n2") #<br /><span class="text-warning">#: kendo.toString(average, "n2") #</span>' }, { headerTemplate: 'Job costs', field: 'job_costs_value_pounds', width: '95px', template: '#=sales_symbol##=kendo.toString(job_costs_value_pounds, "n2")#', footerTemplate: '#: kendo.toString(sum, "n2") #<br /><span class="text-warning">#: kendo.toString(average, "n2") #</span>' }, { headerTemplate: 'Buying <small>total</small>', field: 'buying_total', width: '105px', template: '#=sales_symbol##=kendo.toString(buying_total, "n2")#', footerTemplate: '#: kendo.toString(sum, "n2") #<br /><span class="text-warning">#: kendo.toString(average, "n2") #</span>' }, /*{ headerTemplate: 'Email invoices', field: 'email_invoices', filterable: { ui: gridFunctions.yesNoFilterUI.bind(activeGrid), extra: false }, hidden: true, width: '125px', template: '#=email_invoices ? "Yes" : "No"#' },*/ { headerTemplate: 'Print invoices', field: 'print_invoices', filterable: { ui: gridFunctions.yesNoFilterUI.bind(activeGrid), extra: false }, hidden: true, width: '125px', template: '#=print_invoices ? "Yes" : "No"#' }, { headerTemplate: 'Invoice emailed', field: 'emailed_date', hidden: true, width: '150px', template: '#=emailed_date ? kendo.toString(emailed_date, "dd/MM/yyyy at HH:mm") : "-"#' }, { title: 'ZoneName', field: 'zone_name', hidden: true, template: '#=zone_name#' }, ], filterable: true, sortable: true, scrollable: true }).data("kendoGrid"); } 

但它只是出口的“zone_id”而不是名称,即14出来Italy ,但它没有,它出来了14

我如何得到这个输出模板内容而不是原始值?