这是我的第一个JSON数组格式:
this.columnNames = [
{field : "Name"},
{field : "Address"},
{field : "Age"}
];
这是我的第一个JSON数组格式:
this.rowData = [
{Name : "Praveen",Address : "aiff",Age : "12",w : "1",e : "8"},
{Name : "Akashay",Address : "xvn",Age : "15",w : "2",e : "7"},
{Name : "Bala",Address : "hjk",Age : "16",w : "3",e : "6"},
{Name : "Charu",Address : "sss",Age : "17",w : "4",e : "5"},
];
在这里,我想比较第一个array(columnNames)
数组中存在的VALUE 和第二个数组中存在的KEYS。如果相等,那么我想将第二个匹配的数据推array(rowData)
送到新数组中。
我想要这样的最终结果:
public rowData: any =[
{Name : "Praveen",Address : "aiff",Age : "12"},
{Name : "Akashay",Address : "xvn",Age : "15"},
{Name : "Bala",Address : "hjk",Age : "16"},
{Name : "Charu",Address : "sss",Age : "17"},
];
您自己尝试过吗?
—
TylerH