On change update search filter.

On change update search filter.

ministrypixelministrypixel Posts: 12Questions: 0Answers: 0
edited September 2012 in General
I have a set of links that are clickable. When a link is clicked, the value shows in search box. I am trying to get it where it will search the rows just like keyup changes results. Below is my code snippets. Thank you in advance for your help!

In datatables.js
[code] function _fnFeatureHtmlFilter ( oSettings )
{
var nFilter = document.createElement( 'div' );
if ( oSettings.sTableId !== '' && typeof oSettings.aanFeatures.f == "undefined" )
{
nFilter.setAttribute( 'id', oSettings.sTableId+'_filter' );
}
nFilter.className = oSettings.oClasses.sFilter;
var sSpace = oSettings.oLanguage.sSearch==="" ? "" : " ";
nFilter.innerHTML = oSettings.oLanguage.sSearch+sSpace+'Search: ';

var jqFilter = $("input", nFilter);
jqFilter.val( oSettings.oPreviousSearch.sSearch.replace('"','"') );
jqFilter.change(function(e) {
/* Update all other filter input elements for the new display */
var n = oSettings.aanFeatures.f;
for ( var i=0, iLen=n.length ; i

Replies

  • ministrypixelministrypixel Posts: 12Questions: 0Answers: 0
    Any thoughts? Thanks in advance.
  • ministrypixelministrypixel Posts: 12Questions: 0Answers: 0
    Does anyone know how to do this? Thanks so much!
  • ministrypixelministrypixel Posts: 12Questions: 0Answers: 0
    Any thoughts?
  • allanallan Posts: 63,534Questions: 1Answers: 10,475 Site admin
    If you want to apply a filter, just call fnFilter - that's what it is there for :-)

    [code]
    $('a.myFilter').click( function (e) {
    e.preventDefault();
    table.fnFilter( "myFilter..." );
    } );
    [/code]

    Allan
This discussion has been closed.