Closed Snehil-Shah closed 2 months ago
@mdshamoon are you referring to TableSortLabel
? Because it still requires us to implement the sorting logic as it's just a UI component. I added it and it looks good:
This is the default sort icon. We can still use swapVert
if we want to, although this looks better as it's dynamic...
@mdshamoon done with the changes
@mdshamoon Fixed them. There is still one test failing and I'm not sure if it's related to my PR. Can you check?
Resolves #787
Summary
Added ability to lexicographically sort columns in the list component.
The ability is generic and is controllable by the following props:
isSortable
: An array of booleans, corresponding theheaders
array. true denotes allow sorting that header/columnrowValues
: This turned out to be trickier than I thought. The existingrows
prop to the list component is an array of JSX which can't be sorted lexicographically, hence another prop which is an array of rows with each value being aliteral
representation of the particular JSX value is needed. The rows are sorted based on the rowValues...Example: a list with 2 rows and 2 columns (excluding the action column) will have the following props:
headers = ['name', 'body']
isSortable = [ true, false ]
rows = [ [<h1 val={conn1.name}>, <body val={conn1.body}], [<h1 val={conn2.name}>, <body val={conn2.body}>] ]
rowValues = [ [conn1.name, conn1.body], [conn2.name, conn2.body] ]
These new props are obviously optional and can be neglected if we don't want any sorting in a List...
Added sorting to the first column of
Connections
andSources
to start with. The implementation is generic to the component, so can be changed or used anywhere else.Test Plan