From 22fd8b096773d4738c3d40188db5445ea524c573 Mon Sep 17 00:00:00 2001 From: Allan Jardine Date: Mon, 9 Mar 2015 10:44:07 +0000 Subject: [PATCH] Feature - search highlighting: Improved split of words --- features/searchHighlight/dataTables.searchHighlight.js | 2 +- features/searchHighlight/dataTables.searchHighlight.min.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/features/searchHighlight/dataTables.searchHighlight.js b/features/searchHighlight/dataTables.searchHighlight.js index 6218c12..9da6afc 100644 --- a/features/searchHighlight/dataTables.searchHighlight.js +++ b/features/searchHighlight/dataTables.searchHighlight.js @@ -43,7 +43,7 @@ function highlight( body, table ) // Don't highlight the "not found" row, so we get the rows using the api if ( table.rows( { filter: 'applied' } ).data().length ) { - body.highlight( table.search().split(' ') ); + body.highlight( $.trim( table.search() ).split(/\s+/) ); } } diff --git a/features/searchHighlight/dataTables.searchHighlight.min.js b/features/searchHighlight/dataTables.searchHighlight.min.js index bfbc569..2b66437 100644 --- a/features/searchHighlight/dataTables.searchHighlight.min.js +++ b/features/searchHighlight/dataTables.searchHighlight.min.js @@ -2,5 +2,5 @@ SearchHighlight for DataTables v1.0.1 2014 SpryMedia Ltd - datatables.net/license */ -(function(g,d,a){function e(a,c){a.unhighlight();c.rows({filter:"applied"}).data().length&&a.highlight(c.search().split(" "))}a(d).on("init.dt.dth",function(d,c){var b=new a.fn.dataTable.Api(c),f=a(b.table().body());if(a(b.table().node()).hasClass("searchHighlight")||c.oInit.searchHighlight||a.fn.dataTable.defaults.searchHighlight)b.on("draw.dt.dth column-visibility.dt.dth column-reorder.dt.dth",function(){e(f,b)}).on("destroy",function(){b.off("draw.dt.dth column-visibility.dt.dth column-reorder.dt.dth")}), -b.search()&&e(f,b)})})(window,document,jQuery); +(function(h,g,b){function e(d,c){d.unhighlight();c.rows({filter:"applied"}).data().length&&d.highlight(b.trim(c.search()).split(/\s+/))}b(g).on("init.dt.dth",function(d,c){var a=new b.fn.dataTable.Api(c),f=b(a.table().body());if(b(a.table().node()).hasClass("searchHighlight")||c.oInit.searchHighlight||b.fn.dataTable.defaults.searchHighlight)a.on("draw.dt.dth column-visibility.dt.dth column-reorder.dt.dth",function(){e(f,a)}).on("destroy",function(){a.off("draw.dt.dth column-visibility.dt.dth column-reorder.dt.dth")}), +a.search()&&e(f,a)})})(window,document,jQuery);