Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You can use this function by coping this content :</p> <pre><code>jQuery.fn.dataTableExt.oApi.fnSearchHighlighting = function(oSettings) { oSettings.oPreviousSearch.oSearchCaches = {}; oSettings.oApi._fnCallbackReg( oSettings, 'aoRowCallback', function( nRow, aData, iDisplayIndex, iDisplayIndexFull) { // Initialize search string array var searchStrings = []; var oApi = this.oApi; var cache = oSettings.oPreviousSearch.oSearchCaches; // Global search string // If there is a global search string, add it to the search string array if (oSettings.oPreviousSearch.sSearch) { searchStrings.push(oSettings.oPreviousSearch.sSearch); } // Individual column search option object // If there are individual column search strings, add them to the search string array if ((oSettings.aoPreSearchCols) &amp;&amp; (oSettings.aoPreSearchCols.length &gt; 0)) { for (var i in oSettings.aoPreSearchCols) { if (oSettings.aoPreSearchCols[i].sSearch) { searchStrings.push(oSettings.aoPreSearchCols[i].sSearch); } } } // Create the regex built from one or more search string and cache as necessary if (searchStrings.length &gt; 0) { var sSregex = searchStrings.join("|"); if (!cache[sSregex]) { var regRules = "(" , regRulesSplit = sSregex.split(' '); regRules += "("+ sSregex +")"; for(var i=0; i&lt;regRulesSplit.length; i++) { regRules += "|("+ regRulesSplit[i] +")"; } regRules += ")"; // This regex will avoid in HTML matches cache[sSregex] = new RegExp(regRules+"(?!([^&lt;]+)?&gt;)", 'ig'); } var regex = cache[sSregex]; } // Loop through the rows/fields for matches jQuery('td', nRow).each( function(i) { // Take into account that ColVis may be in use var j = oApi._fnVisibleToColumnIndex( oSettings,i); // Only try to highlight if the cell is not empty or null if (aData[j]) { // If there is a search string try to match if ((typeof sSregex !== 'undefined') &amp;&amp; (sSregex)) { this.innerHTML = aData[j].replace( regex, function(matched) { return "&lt;span class='filterMatches'&gt;"+matched+"&lt;/span&gt;"; }); } // Otherwise reset to a clean string else { this.innerHTML = aData[j]; } } }); return nRow; }, 'row-highlight'); return this; }; </code></pre> <p>inside :</p> <blockquote> <p>dataTables.search-highlight.js</p> </blockquote> <p>an call it like this example:</p> <pre><code>&lt;script type="text/javascript" src="jquery.dataTables.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="dataTables.search-highlight.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; $(document).ready(function() { var oTable = $('#example').dataTable(); oTable.fnSearchHighlighting(); } ); &lt;/script&gt; </code></pre> <p>and add this code to you css file:</p> <pre><code>.filterMatches{ background-color: #BFFF00; } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload