【发布时间】:2016-04-06 15:33:07
【问题描述】:
我正在尝试在我的数据表中显示一些硬编码数据,但由于某种原因它没有显示任何内容。我有以下代码:
js 文件
financialTargetData = [
{"FirstName": 'Dan',
"UserId": "1",
"Sex": 'Male'},
{"FirstName": "Peter",
"UserId": "2",
"Sex": "Male"}
];
attached()
{
var that = this;
$('#financialtargettable').DataTable({
"data": that.financialTargetData,
"lengthMenu": [[12, 24, 36, -1], [12, 24, 36, "All"]],
"paging": true
});
}
html 文件
<template>
<div class="container-fluid">
<div class="row">
<div class="col-sm-12">
<h2>Financial Targets</h2>
<div class="box">
<div class="box-header">
<h3 class="box-title">Data Table With Full Features</h3>
</div><!-- /.box-header -->
<div class="box-body">
<table id="financialtargettable" class="table table-bordered table-striped">
<thead>
<tr>
<th>FirstName</th>
<th>UserId</th>
<th>Sex</th>
<!--<th>GrossWorkingDays</th>-->
<!--<th>NetWorkingDays</th>-->
</tr>
</thead>
</table>
</div><!-- /.box-body -->
</div><!-- /.box -->
</div>
</div>
</div>
我正在使用带有 Aurelia 框架的 javascript ES6。不知道要提供什么更多信息,但这并没有给我任何错误,我只是不知道发生了什么......
任何帮助将不胜感激。
谢谢
【问题讨论】:
标签: javascript html json datatables