javascript - 如何用Ember形成下表?

标签 javascript ember.js ember-table


Name         Date                 Date-1              Date-2              Date-3
------------------------------------------------------------------------------------------
         Header1   Header2    Header1   Header2    Header1   Header2     Header1   Header2
------------------------------------------------------------------------------------------


Name1     val        val        val       val        val       val        val       val

Name2     val        val        val       val        val       val        val       val

Name3     val        val        val       val        val       val        val       val

Name4     val        val        val       val        val       val        val       val 

例如。


Name         May 22             May 21              May 20              May 19
------------------------------------------------------------------------------------------
         Added   Deleted    Added   Deleted    Added   Deleted     Added   Deleted
------------------------------------------------------------------------------------------


Susan     5         6          7       4          2        8         6       2

Rex       1         3          4       6          4        0         1       9

Johny     2         8          5       1          5        4         1       0

Sam       6         5          2       7          6        4         3       0 

数据将以以下格式作为 REST API/JSON 提供

.
.
.
.
{
 "id":123,
 "name":"susan",
 "added": 5,
 "deleted":6,
 "date":"May 22"
},
{
 "id":183,
 "name":"susan",
 "added": 7,
 "deleted":4,
 "date":"May 21"

}
.
.
.
.

有什么解决办法吗?

最佳答案

既然你已经标记了 ember-table,我将从这个 Angular 简要回答:你想要设置的日期格式需要 rowspan,而 ember-table 目前不支持。有人要求将其作为一项功能,我们希望最终添加它;我们将在这里跟踪任何进展:https://github.com/Addepar/ember-table/issues/128 .

Ember Table 可能不是适合您的用例的最佳选择:它是围绕延迟渲染构建的,用于处理大量数据,并且具有许多您可能不需要的其他功能。如果是这种情况,您只需将数据重组为行列表,然后使用 {{#each}} 帮助器一次将一行渲染到标准 HTML 表中,就像 Selvagsz 建议的那样在评论中。

关于javascript - 如何用Ember形成下表?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23821319/

相关文章:

javascript - Ember.js 将元素添加到集合 "magically"

javascript - 什么时候应该在 Ember 中使用路由?

ember.js - Ember : Build error after installing ember-table

javascript - 从 ember-table 单元格中打开模态对话框

javascript - 用 Mongoose 填充字段

javascript - JS : Regular expression to find all function calls in the body of a function

javascript - 在 jQuery 事件处理程序闭包中使用 Ember.js 模型

javascript - React onInput - IE9/10 event.target.value 为空?

javascript - 更新所有 Chart.js 实例以应用更改后的默认值?