Skip to content

Commit

Permalink
Fix: When filtering HTML tags should be striped and were for a simple…
Browse files Browse the repository at this point in the history
… `html` type, but the html numeric types were not also receiving this treatment and thus the tags were included in the filter. This resolves that issue by adding search formatters along with sort formatters when the decimal place is known
  • Loading branch information
Allan Jardine committed Oct 10, 2014
1 parent 5fe15d7 commit d882618
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion js/DataTables.js
Expand Up @@ -200,9 +200,9 @@
require('ext.js');
require('ext.classes.js');
require('ext.paging.js');
require('ext.sorting.js');
require('ext.types.js');
require('ext.filter.js');
require('ext.sorting.js');
require('ext.renderer.js');
require('ext.helpers.js');
require('api.internal.js');
Expand Down
4 changes: 4 additions & 0 deletions js/ext/ext.filter.js
Expand Up @@ -2,6 +2,10 @@

// Filter formatting functions. See model.ext.ofnSearch for information about
// what is required from these methods.
//
// Note that additional search methods are added for the html numbers and
// html formatted numbers by `_addNumericSort()` when we know what the decimal
// place is


$.extend( DataTable.ext.type.search, {
Expand Down
10 changes: 8 additions & 2 deletions js/ext/ext.sorting.js
Expand Up @@ -26,8 +26,8 @@ var __numericReplace = function ( d, decimalPlace, re1, re2 ) {
};


// Add the numeric 'deformatting' functions for sorting. This is done in a
// function to provide an easy ability for the language options to add
// Add the numeric 'deformatting' functions for sorting and search. This is done
// in a function to provide an easy ability for the language options to add
// additional methods if a non-period decimal place is used.
function _addNumericSort ( decimalPlace ) {
$.each(
Expand All @@ -53,7 +53,13 @@ function _addNumericSort ( decimalPlace ) {
}
},
function ( key, fn ) {
// Add the ordering method
_ext.type.order[ key+decimalPlace+'-pre' ] = fn;

// For HTML types add a search formatter that will strip the HTML
if ( key.match(/^html\-/) ) {
_ext.type.search[ key+decimalPlace ] = _ext.type.search.html;
}
}
);
}
Expand Down

0 comments on commit d882618

Please sign in to comment.