Permalink
Browse files

Added support for problem ID searches

  • Loading branch information...
1 parent fbeae83 commit 9c0fbcd5c06cde0e645959632cd0aea4e61cf7f5 @amcnamara amcnamara committed Dec 6, 2011
Showing with 7 additions and 5 deletions.
  1. +7 −5 resources/public/script/foreclojure.js
@@ -81,7 +81,9 @@ var difficulty = {
jQuery.fn.dataTableExt.afnSortData['title'] = function(oSettings, iColumn) {
var aData = [];
$('td:eq('+iColumn+')', oSettings.oApi._fnGetTrNodes(oSettings)).each(function () {
- aData.push($(this).text());
+ // Prefix the data with the link text (title) for proper sorting, then append
+ // target ID so that searching picks it up.
+ aData.push($(this).text() + parseInt($(this).find('a').attr('href').split('/').slice(-1)[0]));
});
return aData;
}
@@ -126,14 +128,14 @@ function configureDataTables(){
$('#problem-table').dataTable( {
"iDisplayLength": 100,
"aaSorting": [[5, "desc"], [1, "asc"], [4, "desc"]],
- "aoColumns": [
+ "aoColumns": [
{"sSortDataType": "title", "sType": "string"},
{"sSortDataType": "difficulty", "sType": "numeric"},
{"sType": "string"},
- {"sType": "string"},
- {"sType": "numeric"},
+ {"sType": "string"},
+ {"sType": "numeric", "bSearchable": false},
{"sType": "string"}
- ]
+ ]
} );
$('#unapproved-problems').dataTable( {

0 comments on commit 9c0fbcd

Please sign in to comment.