【发布时间】:2016-09-06 18:39:40
【问题描述】:
我有一个明确定义的剑道网格。
我通过data-toolbar='["excel"]'启用了excel导出工具栏
问题是这只会导出没有定义模板的字段。 (下面网格中的前 3 个:检查点、位置、巡逻者),其他列显示在 excel 文档中,但这些列的单元格都是空的。
如何让值显示在 excel 导出中?我猜它需要在导出 excel 之前进行某种预处理,因为 excel 导出功能不会解释我的自定义字段 html 模板。
<div id="Checkpoints">
<div
...
data-toolbar='["excel"]'
data-excel='{ "fileName": "CheckpointExceptionExport.xlsx", "allPages": "true" }'
...
data-columns='[
{
"field": "checkpoint_name",
"title": "Checkpoint",
"filterable": { "cell": { "operator": "contains"}}},
{
"field": "location_name",
"title": "Location",
"filterable": { "cell": { "operator": "contains"}}
},
{
"field": "patrolled_by",
"title": "Patrolled By",
"filterable": { "cell": { "operator": "contains"}}
},
{
"field": "geotag",
"title": "GeoTag",
"template": kendo.template($("#geotagTemplate").html())
},
{
"field": "geofence",
"title": "GeoFence",
"template": kendo.template($("#geofenceTemplate").html())
},
{
"field": "completed",
"title": "Completed",
"template": kendo.template($("#completedTemplate").html())
},
{
"field": "gps",
"title": "GPS",
"template": kendo.template($("#gpsTemplate").html())
}
]'>
</div>
</div>
我遇到了这个用于处理 excel 导出事件的 sn-p,但是我没有看到以我定义网格的方式使用这个事件处理程序的方法。
<script>
$("#grid").kendoGrid({
excelExport: function(e) {
...
},
});
</script>
【问题讨论】:
标签: javascript html excel kendo-ui kendo-grid