Duplicate html ids on search box

Duplicate html ids on search box

cpettifercpettifer Posts: 12Questions: 0Answers: 0
edited March 2011 in Bug reports
I hope I'm not doing something silly...

I have two datatables on one screen. The tables themselves have different html ids and most of the elements in the generated datatable seem to have ids relating to that table, but the search / filter box has the same id in both tables. This is causing us problems.

Is it a bug? Is there a workaround?

I've tried using JQuery to update the id, but it doesn't appear to work.

Replies

  • allanallan Posts: 63,692Questions: 1Answers: 10,500 Site admin
    Could you post a link to your example please? You are quite right - this shouldn't happen.

    Allan
  • cpettifercpettifer Posts: 12Questions: 0Answers: 0
    It will prove tricky to provide a link as it's on a private intranet type site. I'll see what I can do to knock a simple example together to drop in here instead. Also, there's a lot of autogenerated content (such as the table itself), so I may have work that out too!
  • cpettifercpettifer Posts: 12Questions: 0Answers: 0
    I'm now wondering if we're actually trying to set the id somewhere in our code as my example page I'm trying to create to post here didn't actually have ids on those input boxes. Hmmm.
  • cpettifercpettifer Posts: 12Questions: 0Answers: 0
    Found it - our fault. Apologies.

    It would actually be helpful if datatables assigned an id to this input box!! :-)
  • allanallan Posts: 63,692Questions: 1Answers: 10,500 Site admin
    Heh - no problem. DataTables assigns an id to the div surrounding the input for the search, so a selector is trivial for the input (i.e. '#whateverid_filter input').

    Regards,
    Allan
  • cpettifercpettifer Posts: 12Questions: 0Answers: 0
    Ah yes, very easy in my code to get hold of the input - however, no good for our test team's automated toolset that requires each element to have a unique html id. I'm putting one in now by using the selector as you have written and adding an id to that element.
This discussion has been closed.