| 686 | |
| 687 | // highlight search keywords |
| 688 | var highlight = function() { |
| 689 | var body = $(table.table().body()); |
| 690 | // removing the old highlighting first |
| 691 | body.unhighlight(); |
| 692 | |
| 693 | // don't highlight the "not found" row, so we get the rows using the api |
| 694 | if (table.rows({ filter: 'applied' }).data().length === 0) return; |
| 695 | // highlight global search keywords |
| 696 | body.highlight($.trim(table.search()).split(/\s+/)); |
| 697 | // then highlight keywords from individual column filters |
| 698 | if (filterRow) filterRow.each(function(i, td) { |
| 699 | var $td = $(td), type = $td.data('type'); |
| 700 | if (type !== 'character') return; |
| 701 | var $input = $td.children('div').first().children('input'); |
| 702 | var column = table.column(i).nodes().to$(), |
| 703 | val = $.trim($input.val()); |
| 704 | if (type !== 'character' || val === '') return; |
| 705 | column.highlight(val.split(/\s+/)); |
| 706 | }); |
| 707 | }; |
| 708 | |
| 709 | if (options.searchHighlight) { |
| 710 | table |