Commit 952dcca9 authored by Deni Rinaldi's avatar Deni Rinaldi

sorting unitbisnis

parent 48b74075
...@@ -50,12 +50,14 @@ export default class UnitBisnis extends Component { ...@@ -50,12 +50,14 @@ export default class UnitBisnis extends Component {
let isi = resp.rows.slice(3) let isi = resp.rows.slice(3)
let payload = [] let payload = []
isi.map((item, index) => { isi.map((item, index) => {
if (item.length > 0) {
payload.push({ payload.push({
id: index + 1, id: index + 1,
business_unit_name: item[0], business_unit_name: item[0],
start_date: item[1], start_date: item[1],
end_date: item[2], end_date: item[2],
}) })
}
}) })
let body = { let body = {
business_unit: payload business_unit: payload
...@@ -170,8 +172,6 @@ export default class UnitBisnis extends Component { ...@@ -170,8 +172,6 @@ export default class UnitBisnis extends Component {
}) })
// console.log(JSON.stringify(payload));
} }
}); });
} }
...@@ -185,7 +185,7 @@ export default class UnitBisnis extends Component { ...@@ -185,7 +185,7 @@ export default class UnitBisnis extends Component {
console.log(response) console.log(response)
if (response.data.status == 'success') { if (response.data.status == 'success') {
let data = response.data.data let data = response.data.data
let listData = data.map((item, index) => { let listData = data.sort((a,b) => a.business_unit_id - b.business_unit_id).map((item, index) => {
return [index, item.business_unit_id, item.business_unit_name, item.status] return [index, item.business_unit_id, item.business_unit_name, item.status]
}) })
this.setState({ dataTable: listData, listData: response.data.data }) this.setState({ dataTable: listData, listData: response.data.data })
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment