Javascript 角度材质垫表将标题动态拆分为组
我有一个动态渲染数据的角垫表。现在,我想拆分标题并按类别显示列 这是下面的代码,我正在通过它渲染mat表,现在我想转换它。任何帮助都将不胜感激。:)Javascript 角度材质垫表将标题动态拆分为组,javascript,json,angular,typescript,angular-material,Javascript,Json,Angular,Typescript,Angular Material,我有一个动态渲染数据的角垫表。现在,我想拆分标题并按类别显示列 这是下面的代码,我正在通过它渲染mat表,现在我想转换它。任何帮助都将不胜感激。:) 输出 |--------------------------------------------------------------------------------------------- | Name | UPTT... |
输出
|---------------------------------------------------------------------------------------------
| Name | UPTT... | DPTT.. | APTT.. |
| | -----------------------------------------------------------------------------
| | U1A_Shift SCM | U3B SCM | U1B SCM | U1A_Shift SCM | U1B SCM | U3B SCM |
|---------------------------------------------------------------------------------------------
| U3B | - | 3413.00 | - | - | - | 3510.00 |
| U1B | - | 3 | 1044.00 | - | 631.00 | - |
| U1A_Shift | 321.00 | 3 | - | 1909.00 | - | - |
|--------------------------------------------------------------------------------------------|
This is the tableOfObjects
[
{
"Severity": "<span class='tableActive'></span>",
"Name": "U3B",
"U1A_Shift SCM: UPTT-Pressure (Bara)": "-",
"U1A_Shift SCM: DPTT-Pressure (Bara)": "-",
"U3B SCM: APTT-Pressure (Bara)": "3510.00",
"U3B SCM: UPTT-Pressure (Bara)": "3413.00",
"U1B SCM: DPTT-Pressure (Bara)": "-",
"U1B SCM: UPTT-Pressure (Bara)": "-",
"U3B SCM: DPTT-Pressure (Bara)": "740.00",
"U1A_Shift SCM: UPTT-Temp (DegC)": "-",
"U1A_Shift SCM: DPTT-Temp (DegC)": "-",
"U3B SCM: APTT-Temp (DegC)": "1565.00",
"U3B SCM: UPTT-Temp (DegC)": "2654.00",
"U1B SCM: DPTT-Temp (DegC)": "-",
"U1B SCM: UPTT-Temp (DegC)": "-",
"U3B SCM: DPTT-Temp (DegC)": "3159.00",
"U1B SCM: PCV-CHOKE status - Control position": "-",
"U3B SCM: PCV-CHOKE status - Control position": "-",
"U1A_Shift SCM: PCV-CHOKE status - Control position": "-",
"Alarms": 0,
"Advisories": 0,
"__row_index": 0
},
{
"Severity": "<span class='tableActive'></span>",
"Name": "U1B",
"U1A_Shift SCM: UPTT-Pressure (Bara)": "-",
"U1A_Shift SCM: DPTT-Pressure (Bara)": "-",
"U3B SCM: APTT-Pressure (Bara)": "-",
"U3B SCM: UPTT-Pressure (Bara)": "-",
"U1B SCM: DPTT-Pressure (Bara)": "631.00",
"U1B SCM: UPTT-Pressure (Bara)": "1044.00",
"U3B SCM: DPTT-Pressure (Bara)": "-",
"U1A_Shift SCM: UPTT-Temp (DegC)": "-",
"U1A_Shift SCM: DPTT-Temp (DegC)": "-",
"U3B SCM: APTT-Temp (DegC)": "-",
"U3B SCM: UPTT-Temp (DegC)": "-",
"U1B SCM: DPTT-Temp (DegC)": "2895.00",
"U1B SCM: UPTT-Temp (DegC)": "3346.00",
"U3B SCM: DPTT-Temp (DegC)": "-",
"U1B SCM: PCV-CHOKE status - Control position": "-",
"U3B SCM: PCV-CHOKE status - Control position": "-",
"U1A_Shift SCM: PCV-CHOKE status - Control position": "-",
"Alarms": 0,
"Advisories": 0,
"__row_index": 1
},
{
"Severity": "<span class='tableActive'></span>",
"Name": "U1A_Shift",
"U1A_Shift SCM: UPTT-Pressure (Bara)": "321.00",
"U1A_Shift SCM: DPTT-Pressure (Bara)": "1909.00",
"U3B SCM: APTT-Pressure (Bara)": "-",
"U3B SCM: UPTT-Pressure (Bara)": "-",
"U1B SCM: DPTT-Pressure (Bara)": "-",
"U1B SCM: UPTT-Pressure (Bara)": "-",
"U3B SCM: DPTT-Pressure (Bara)": "-",
"U1A_Shift SCM: UPTT-Temp (DegC)": "3031.00",
"U1A_Shift SCM: DPTT-Temp (DegC)": "2234.00",
"U3B SCM: APTT-Temp (DegC)": "-",
"U3B SCM: UPTT-Temp (DegC)": "-",
"U1B SCM: DPTT-Temp (DegC)": "-",
"U1B SCM: UPTT-Temp (DegC)": "-",
"U3B SCM: DPTT-Temp (DegC)": "-",
"U1B SCM: PCV-CHOKE status - Control position": "-",
"U3B SCM: PCV-CHOKE status - Control position": "-",
"U1A_Shift SCM: PCV-CHOKE status - Control position": "-",
"Alarms": 0,
"Advisories": 0,
"__row_index": 2
}
]
this.tableOfObjects = this.getTableOfObjects(columns, rows);
this.dataSource = new MatTableDataSource(this.tableOfObjects);
|---------------------------------------------------------------------------------------------
|名称| UPTT…|DPTT.|APTT|
| | -----------------------------------------------------------------------------
|| U1A | U3B SCM | U1B SCM | U1A | U1B SCM | U1B SCM | U3B SCM|
|---------------------------------------------------------------------------------------------
|U3B |-| 3413.00 |-|-|-|-| 3510.00|
|U1B |-| 3 | 1044.00 |-| 631.00 |-|
|U1A|U班次321.00|3|-1909.00|-|
|--------------------------------------------------------------------------------------------|
这是对象表
[
{
“严重性”:“,
“名称”:“U3B”,
“U1A_换档SCM:上升压力(Bara)”:“-”,
“U1A_换档SCM:DPTT压力(Bara)”:“-”,
“U3B SCM:APTT压力(Bara)”:“3510.00”,
“U3B SCM:UPTT压力(巴拉)”:“3413.00”,
“U1B SCM:DPTT压力(巴拉)”:“-”,
“U1B SCM:UPTT压力(巴拉)”:“-”,
“U3B SCM:DPTT压力(巴拉)”:“740.00”,
“U1A_换档SCM:UPTT温度(DegC)”:“-”,
“U1A_换档SCM:DPTT温度(DegC)”:“-”,
“U3B SCM:APTT温度(DegC)”:“1565.00”,
“U3B SCM:UPTT温度(摄氏度)”:“2654.00”,
“U1B SCM:DPTT温度(DegC)”:“-”,
“U1B SCM:UPTT温度(DegC)”:“-”,
“U3B SCM:DPTT温度(DegC)”:“3159.00”,
“U1B SCM:PCV-扼流圈状态-控制位置”:“-”,
“U3B SCM:PCV-扼流圈状态-控制位置”:“-”,
“U1A_换档SCM:PCV-扼流圈状态-控制位置”:“-”,
“警报”:0,
“咨询”:0,
“\u行\u索引”:0
},
{
“严重性”:“,
“名称”:“U1B”,
“U1A_换档SCM:上升压力(Bara)”:“-”,
“U1A_换档SCM:DPTT压力(Bara)”:“-”,
“U3B SCM:APTT压力(Bara)”:“-”,
“U3B SCM:UPTT压力(Bara)”:“-”,
“U1B SCM:DPTT压力(巴拉)”:“631.00”,
“U1B SCM:UPTT压力(巴拉)”:“1044.00”,
“U3B SCM:DPTT压力(巴拉)”:“-”,
“U1A_换档SCM:UPTT温度(DegC)”:“-”,
“U1A_换档SCM:DPTT温度(DegC)”:“-”,
“U3B SCM:APTT温度(DegC)”:“-”,
“U3B SCM:UPTT温度(DegC)”:“-”,
“U1B SCM:DPTT温度(DegC)”:“2895.00”,
“U1B SCM:UPTT温度(DegC)”:“3346.00”,
“U3B SCM:DPTT温度(DegC)”:“-”,
“U1B SCM:PCV-扼流圈状态-控制位置”:“-”,
“U3B SCM:PCV-扼流圈状态-控制位置”:“-”,
“U1A_换档SCM:PCV-扼流圈状态-控制位置”:“-”,
“警报”:0,
“咨询”:0,
“\u行\u索引”:1
},
{
“严重性”:“,
“名称”:“U1A\U班次”,
“U1A_换档SCM:UPTT压力(巴拉)”:“321.00”,
“U1A_换档SCM:DPTT压力(巴拉)”:“1909.00”,
“U3B SCM:APTT压力(Bara)”:“-”,
“U3B SCM:UPTT压力(Bara)”:“-”,
“U1B SCM:DPTT压力(巴拉)”:“-”,
“U1B SCM:UPTT压力(巴拉)”:“-”,
“U3B SCM:DPTT压力(巴拉)”:“-”,
“U1A_-Shift SCM:UPTT温度(DegC)”:“3031.00”,
“U1A_-Shift SCM:DPTT温度(DegC)”:“2234.00”,
“U3B SCM:APTT温度(DegC)”:“-”,
“U3B SCM:UPTT温度(DegC)”:“-”,
“U1B SCM:DPTT温度(DegC)”:“-”,
“U1B SCM:UPTT温度(DegC)”:“-”,
“U3B SCM:DPTT温度(DegC)”:“-”,
“U1B SCM:PCV-扼流圈状态-控制位置”:“-”,
“U3B SCM:PCV-扼流圈状态-控制位置”:“-”,
“U1A_换档SCM:PCV-扼流圈状态-控制位置”:“-”,
“警报”:0,
“咨询”:0,
“\u行\u索引”:2
}
]
this.tableOfObjects=this.getTableOfObject(列、行);
this.dataSource=新MatTableDataSource(this.tableOfObjects);
FFEWFGEWGEWGREGREGREGREGHTRHT565476T35您能显示dataSource@AdritaSharma:添加plz检查
|---------------------------------------------------------------------------------------------
| Name | UPTT... | DPTT.. | APTT.. |
| | -----------------------------------------------------------------------------
| | U1A_Shift SCM | U3B SCM | U1B SCM | U1A_Shift SCM | U1B SCM | U3B SCM |
|---------------------------------------------------------------------------------------------
| U3B | - | 3413.00 | - | - | - | 3510.00 |
| U1B | - | 3 | 1044.00 | - | 631.00 | - |
| U1A_Shift | 321.00 | 3 | - | 1909.00 | - | - |
|--------------------------------------------------------------------------------------------|
This is the tableOfObjects
[
{
"Severity": "<span class='tableActive'></span>",
"Name": "U3B",
"U1A_Shift SCM: UPTT-Pressure (Bara)": "-",
"U1A_Shift SCM: DPTT-Pressure (Bara)": "-",
"U3B SCM: APTT-Pressure (Bara)": "3510.00",
"U3B SCM: UPTT-Pressure (Bara)": "3413.00",
"U1B SCM: DPTT-Pressure (Bara)": "-",
"U1B SCM: UPTT-Pressure (Bara)": "-",
"U3B SCM: DPTT-Pressure (Bara)": "740.00",
"U1A_Shift SCM: UPTT-Temp (DegC)": "-",
"U1A_Shift SCM: DPTT-Temp (DegC)": "-",
"U3B SCM: APTT-Temp (DegC)": "1565.00",
"U3B SCM: UPTT-Temp (DegC)": "2654.00",
"U1B SCM: DPTT-Temp (DegC)": "-",
"U1B SCM: UPTT-Temp (DegC)": "-",
"U3B SCM: DPTT-Temp (DegC)": "3159.00",
"U1B SCM: PCV-CHOKE status - Control position": "-",
"U3B SCM: PCV-CHOKE status - Control position": "-",
"U1A_Shift SCM: PCV-CHOKE status - Control position": "-",
"Alarms": 0,
"Advisories": 0,
"__row_index": 0
},
{
"Severity": "<span class='tableActive'></span>",
"Name": "U1B",
"U1A_Shift SCM: UPTT-Pressure (Bara)": "-",
"U1A_Shift SCM: DPTT-Pressure (Bara)": "-",
"U3B SCM: APTT-Pressure (Bara)": "-",
"U3B SCM: UPTT-Pressure (Bara)": "-",
"U1B SCM: DPTT-Pressure (Bara)": "631.00",
"U1B SCM: UPTT-Pressure (Bara)": "1044.00",
"U3B SCM: DPTT-Pressure (Bara)": "-",
"U1A_Shift SCM: UPTT-Temp (DegC)": "-",
"U1A_Shift SCM: DPTT-Temp (DegC)": "-",
"U3B SCM: APTT-Temp (DegC)": "-",
"U3B SCM: UPTT-Temp (DegC)": "-",
"U1B SCM: DPTT-Temp (DegC)": "2895.00",
"U1B SCM: UPTT-Temp (DegC)": "3346.00",
"U3B SCM: DPTT-Temp (DegC)": "-",
"U1B SCM: PCV-CHOKE status - Control position": "-",
"U3B SCM: PCV-CHOKE status - Control position": "-",
"U1A_Shift SCM: PCV-CHOKE status - Control position": "-",
"Alarms": 0,
"Advisories": 0,
"__row_index": 1
},
{
"Severity": "<span class='tableActive'></span>",
"Name": "U1A_Shift",
"U1A_Shift SCM: UPTT-Pressure (Bara)": "321.00",
"U1A_Shift SCM: DPTT-Pressure (Bara)": "1909.00",
"U3B SCM: APTT-Pressure (Bara)": "-",
"U3B SCM: UPTT-Pressure (Bara)": "-",
"U1B SCM: DPTT-Pressure (Bara)": "-",
"U1B SCM: UPTT-Pressure (Bara)": "-",
"U3B SCM: DPTT-Pressure (Bara)": "-",
"U1A_Shift SCM: UPTT-Temp (DegC)": "3031.00",
"U1A_Shift SCM: DPTT-Temp (DegC)": "2234.00",
"U3B SCM: APTT-Temp (DegC)": "-",
"U3B SCM: UPTT-Temp (DegC)": "-",
"U1B SCM: DPTT-Temp (DegC)": "-",
"U1B SCM: UPTT-Temp (DegC)": "-",
"U3B SCM: DPTT-Temp (DegC)": "-",
"U1B SCM: PCV-CHOKE status - Control position": "-",
"U3B SCM: PCV-CHOKE status - Control position": "-",
"U1A_Shift SCM: PCV-CHOKE status - Control position": "-",
"Alarms": 0,
"Advisories": 0,
"__row_index": 2
}
]
this.tableOfObjects = this.getTableOfObjects(columns, rows);
this.dataSource = new MatTableDataSource(this.tableOfObjects);