Filtering not working? Search only returns zero results?

Filtering not working? Search only returns zero results?

msplantmsplant Posts: 2Questions: 0Answers: 0
edited June 2009 in Bug reports
I just found your plugin and it looks awesome! However I just tried it on a site I was working on today and the filtering doesn't appear to be working? I do have 1700+ rows so I wasn't sure what could be causing this issue? If you have some time here is the site address for you to look.

Any help would be appreciated, I would love to donate some cash as this is a real time saver! Keep up the hard work!

Replies

  • allanallan Posts: 62,034Questions: 1Answers: 10,168 Site admin
    Hi msplant,

    Thanks very much for your kind works and also the link - really does make debugging much easier :-)

    I tried your link and it looking like it was working for the most part, but not the filtering. I think this might be due to an error in your thead HTML, and also a slightly unexpected use of td:

    1. There is no TR element in your thead which is required
    2. DataTables expects TH elements in the header rather than TD

    Try changing your thead to:

    [code]


    Madison
    Arlington
    Bridgeport
    Crouse-Hinds
    Neer

    Raco
    T&B Steel City
    Topaz


    [/code]

    I think that should do the trick.

    Allan
  • msplantmsplant Posts: 2Questions: 0Answers: 0
    Thanks Allan,

    I figured it was something trivial. I'll give it a try!

    I really like how this works!

    Mike
  • cberger31cberger31 Posts: 2Questions: 0Answers: 0
    edited June 2010
    (EDIT: Aha... I figured out my issue... will post again below for posterity sake... edited out my ugly html since it shouldn't be needed)

    Is there something else that might cause this issue? I am using ASP.NET to generate the table and then applying DataTables formatting on top of it. Everything works great except that Searching *always* returns 0 results. I am fixing the table headers in the DataBound event for the user control (because ASP doesn't put the and tags in automatically). Is there a command I'm missing that enables searching? My init command is:

    [code]$("table.detailgrid").dataTable({
    bJQueryUI: true,
    bStateSave: true,
    bSortClasses: false,
    bProcessing: true,
    aLengthMenu: [10, 20, 30, 40, 50, 100]
    });[/code]

    After DataTables has intialized, my DOM source looks like this (sorry this is so long and ugly...):
    (EDIT: snipped this unnecessary code)
  • cberger31cberger31 Posts: 2Questions: 0Answers: 0
    So, I mostly figured out my problem - the first column in the table, and the last column in the table had no text, just input tags. When I set those columns to be non-searchable, using the aoColumns option like so: { aoColumns: [ { bSearchable: false }, null, null, ...etc..., { bSearchable: false }] }... then my table suddenly became searchable. Since I don't want to search those columns anyway, it works fine.

    I'm not entirely sure *why* searching those columns was making the entire search fail, but problem solved. =)
  • fgolemofgolemo Posts: 1Questions: 0Answers: 0
    Thank you SUUUCH a lot for the solution! Did it for me too. :)
This discussion has been closed.