Bind AutoFill to an input not generated by DataTables

Bind AutoFill to an input not generated by DataTables

cameroncfcameroncf Posts: 3Questions: 0Answers: 0
edited January 2012 in General
I'm looking through the docs for a way to do this and haven't seen it yet. It's probably there, I just haven't gotten it working yet.

What I'd like to do is bind the generic autofill trigger to an input elsewhere on the page, not the one auto-generated by DataTables. I'd also like to disable or hide the autofill generated by DataTables, as well as the pagination and "Show N Entires" controls.

I suspect I am just looking in the wrong spot in the docs, and I haven't seen an example that addresses this (yet).

Suggestions?

-Cameron

Replies

  • allanallan Posts: 63,538Questions: 1Answers: 10,476 Site admin
    edited January 2012
    > pagination
    > "Show N Entires" controls.

    These two are easy to answer - use the sDom parameter - just remove the two features you don't want. If you want ti disable the features completely, then simply use bPaginate and bInfo .

    > What I'd like to do is bind the generic autofill trigger to an input elsewhere on the page

    I'm not quite sure what you mean - so a click on a button would fill in a column perhaps? This isn't a feature that is available as part of AutoFill. Instead what would be needed is to loop over the rows/columns you want to update and use the fnUpdate method to put in the data you want.

    Allan
  • cameroncfcameroncf Posts: 3Questions: 0Answers: 0
    I'll look into out the sDom param.

    As to the other part of my question, what I'm trying to do is essentially eliminate the automagically generated text input "filter" field and instead use another field elsewhere on the page. There is a search text input far away from the table and I'd like *that* text input to serve as the filter field so that when text is typed into that field the table starts to filter based on the input.

    -Cameron
  • allanallan Posts: 63,538Questions: 1Answers: 10,476 Site admin
    That's easy enough done with the fnFilter API method. Just bind a keyup event to your input and have the table filter on the value using fnFilter .

    Allan
  • cameroncfcameroncf Posts: 3Questions: 0Answers: 0
    I was just coming back to followup on this thread to say I'd found the solution using fnFilter. Attached a keyup() listener to the field ID and called fnFilter using the field's content.

    [code]
    $('#search-users-input').keyup( function () {
    oTable.fnFilter( $(this).val() );
    });
    [/code]

    Thanks for the help!

    -Cameron
This discussion has been closed.