Add: sort by number of stars

This commit is contained in:
Kyle King 2018-09-16 10:18:42 -04:00
parent dea412749d
commit fd087577f5
1 changed files with 5 additions and 0 deletions

View File

@ -45,11 +45,16 @@ function initDT() {
[ 'Last Push', 'pushed_at' ],
]
// Sort by stars:
const sortColName = 'Stars'
const sortColumnIdx = window.columnNamesMap.map( pair => pair[0] ).indexOf( sortColName )
// Use first index for readable column name
window.forkTable = $( '#forkTable' ).DataTable( {
columns: window.columnNamesMap.map( colNM => {
return {'title': colNM[0]}
} ),
'order': [[sortColumnIdx, 'desc']],
} )
}