Fix table ordering

pull/10616/head
ebb-tide 2018-04-09 16:17:31 -07:00
parent 2d8a447f4b
commit 72d15e4d1d
1 changed files with 3 additions and 5 deletions

View File

@ -200,13 +200,11 @@ export const filterTableColumns = (data, fieldNames) => {
} }
export const orderTableColumns = (data, fieldNames) => { export const orderTableColumns = (data, fieldNames) => {
const fieldsSortOrder = fieldNames.map(v => { const fieldsSortOrder = fieldNames.map(fieldName => {
return data[0].indexOf(v.displayName || v.internalName) return data[0].findIndex(dataLabel => dataLabel == fieldName.internalName)
}) })
const orderedData = map(data, row => { const orderedData = map(data, row => {
return row.map((v, j, arr) => { return row.map((v, j, arr) => arr[fieldsSortOrder[j]])
return arr[fieldsSortOrder[j]]
})
}) })
return orderedData[0].length ? orderedData : [[]] return orderedData[0].length ? orderedData : [[]]
} }