我有一个如下所示的数据集合:
[{"disposition": {"dispositionId":1,"name":"smdnfgn","code":"jkkhkl;hklhlkjhlhkj","description":"DM_Description 1","sortIndex":1,"status":"DM_St 1"}},{"disposition":{"dispositionId":2,"name":"DM_Name 2","code":"DM_Code 2;lkfdg;l'ksadfg","description":"DM_Description 2","sortIndex":2,"status":"DM_St 2"}}, . . .]
如您所见,后端 RESTful 服务返回的 JSON 数组是“配置对象”,每个对象都有一个复杂对象(配置 ID、名称、...)。
当我将此集合传递给智能表时,我只得到标题。
但是,当我运行一种方法来删除“处置”并将其转换为更简单的数组时,例如:
[{"dispositionId":1,"name":"smdnfgn","code":"jkkhkl;hklhlkjhlhkj","description":"DM_Description 1","sortIndex":1,"status":"DM_St 1"},{"dispositionId":2,"name":"DM_Name 2","code":"DM_Code 2;lkfdg;l'ksadfg","description":"DM_Description 2","sortIndex":2,"status":"DM_St 2"}, . . .]
一切正常。有没有办法让 SMart-Table 识别标准 JSON 配置,而无需在检索数据后对其进行编辑?我觉得我忽略了一些东西。
我看表格的方法在这里:
<div ng-controller="dispositionSmartCtrl">
<hr>
DispoElements
<smart-table class="table table-striped" table-title="DispoElements"
config="globalConfig" rows=dispoElements columns="columnCollectionDispo">
</smart-table>
{{dispoElements}}<br /><hr><br />
Disposition RowDispositions
<smart-table class="table table-striped" table-title="RowDispositions"
config="globalConfig" rows=rowDispositions columns="columnCollectionDispo">
</smart-table>
{{rowDispositions}}
唯一的区别是使用的集合,一个是复杂对象,另一个是普通数组。我已经尝试过 {{}} 并且还在执行“rowCollections.disposition”,第一个导致页面完全失败,第二个给了我一个只有标题的表。