相关疑难解决方法(0)

从嵌套的json中进行Angular 4数据表排序

需要有关嵌套数据的Angular数据表的帮助.

我想对表中的数据进行排序.

我使用的数据表来自 - https://www.npmjs.com/package/angular2-datatable

数据表适用于单个数组类型的数据.(用于许多角度应用)

问题:我已经嵌套了json(实际上,我有复杂的json,这里很简单)

感谢您查看这个.

任何建议或帮助表示赞赏.

JSON

records = [
  [
    {
      "name": "Subject Name",
      "type": "text",
      "id": "subjectName",
      "value": "DavidJ",
      "firstName": "David",
      "lastName": "John"
    },
    {
      "name": "QC Name",
      "type": "hidden",
      "id": "qcName",
      "value": "JosephT",
      "firstName": "Joseph",
      "lastName": "Tom"
    }
  ],
  [
    {
      "name": "Subject Name",
      "type": "text",
      "id": "subjectName",
      "value": "TigerC",
      "firstName": "Tiger",
      "lastName": "Chan"
    },
    {
      "name": "QC Name",
      "type": "hidden",
      "id": "qcName",
      "value": "ThomasR",
      "firstName": "Thomas",
      "lastName": "Richard"
    }
  ]
]
Run Code Online (Sandbox Code Playgroud)

HTML …

javascript datatable json nested angular

14
推荐指数
4
解决办法
1406
查看次数

Element implicitly has an 'any' type because expression of type 'string' can't be used to index

Trying out TypeScript for a React project and I'm stuck on this error:

Element implicitly has an 'any' type because expression of type 'string' can't be used to index type '{ train_1: boolean; train_2: boolean; train_3: boolean; train_4: boolean; }'.
  No index signature with a parameter of type 'string' was found on type '{ train_1: boolean; train_2: boolean; train_3: boolean; train_4: boolean; }'
Run Code Online (Sandbox Code Playgroud)

Which appears when I try to filter the array in my component

.filter(({ name }) => plotOptions[name]); …
Run Code Online (Sandbox Code Playgroud)

typescript reactjs

6
推荐指数
13
解决办法
4917
查看次数

标签 统计

angular ×1

datatable ×1

javascript ×1

json ×1

nested ×1

reactjs ×1

typescript ×1