Cleaned up the L&F; Added table sorting; Cleaned up the table styling.
This commit is contained in:
@@ -105,18 +105,45 @@ export default () => {
|
||||
{
|
||||
name: "Asset ID",
|
||||
value: (row) => row.assetId,
|
||||
descendingComparator: (a, b) => {
|
||||
if(a.assetId === b.assetId) return 0
|
||||
else if(!a.assetId) return -1
|
||||
else if(!b.assetId) return 1
|
||||
else if(a.assetId.length < b.assetId.length) return 1
|
||||
else if(a.assetId.length > b.assetId.length) return -1
|
||||
else if(b.assetId < a.assetId) return -1
|
||||
else return 1
|
||||
}
|
||||
},
|
||||
{
|
||||
name: "Serial",
|
||||
value: (row) => row.serial,
|
||||
descendingComparator: (a, b) => {
|
||||
if(a.serial === b.serial) return 0
|
||||
else if(!a.serial) return -1
|
||||
else if(!b.serial) return 1
|
||||
else if(a.serial.length < b.serial.length) return 1
|
||||
else if(a.serial.length > b.serial.length) return -1
|
||||
else if(b.serial < a.serial) return -1
|
||||
else return 1
|
||||
}
|
||||
},
|
||||
{
|
||||
name: "Condition",
|
||||
value: (row) => row.condition,
|
||||
descendingComparator: (a, b) => {
|
||||
if(b.condition === a.condition) return 0 //Most common case
|
||||
// Find the first matching condition in order.
|
||||
for(let condition of conditions) {
|
||||
if(b.condition === condition) return -1
|
||||
else if(a.condition === condition) return 1
|
||||
}
|
||||
return 0
|
||||
}
|
||||
},
|
||||
{
|
||||
name: "AssetType",
|
||||
value: (row) => row.assetType.name,
|
||||
value: (row) => row.assetType ? row.assetType.name : "",
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user