# SortOptions
Defines the behavior of column sorting. Consists of an array of objects with the following format
{
label: // the text displayed in the NioSelect in the header of the table
value: {
itemProp: // the the item property to sort by, as defined in the table's _items_ prop
order: // direction of sort. Either 'ascending' or 'descending'
}
}
# Example
Given the following items array:
{
id: 1,
orderName: "Test Order",
expires: "10 Jan 2010"
},
{
id: 2,
orderName: "Chris's test",
expires: "12 Feb 2010"
},
{
id: 3,
orderName: "Another order",
expires: "1 August 2010"
}
The following sortOptions prop value would allow the user to choose from four sorting options that would sort the table's items by orderName or expires, each in either ascending or descending order.
[
{
label: 'Alphabetic [A-Z]',
value: {
itemProp: 'orderName',
order: 'ascending'
}
},
{
label: 'Alphabetic [Z-A]',
value: {
itemProp: 'orderName',
order: 'descending'
}
},
{
label: 'Date [newest - oldest]',
value: {
itemProp: 'expires',
order: 'asscending'
}
},
{
label: 'Date [oldest - newest]',
value: {
itemProp: 'expires',
order: 'descending'
}
}
]
TIP
If sortOptions does not contain an entry for a particular key in the items prop, sorting by that field will not be allowed. Only keys which have respective options provided in sortOptions will be sortable