I used jQuery to modify length & filter objects and I disabled JS functionality...

I used jQuery to modify length & filter objects and I disabled JS functionality...

MFGMFG Posts: 12Questions: 5Answers: 0

I'm new to DataTables and have been working on implementing & customizing the basic example to learn more about how to use this fantastic tool. I've learned a tremendous amount going through the examples, searching the support forum and exploring the docs/manual.

I am currently stuck on the following: I am trying to do make some minor cosmetic changes to the length object and the filter object using jQuery. The changes are being made the way I want them. However, in doing so, it appears that I have inadvertently disabled the functionality of the dropdown button and the search box. (Note: I am fairly new to JS/jQuery too).

I have my example posted at: http://live.datatables.net/kuyiqoku/3/edit.

The code in question is toward the buttom of the Javascript, inside a conditional statement. When the condition is TRUE, my questionable code is executed and the JS functionality is disabled. When the condition is FALSE, everything works fine.

Hope this is clear. Any help/suggestions would be greatly appreciated.

This question has an accepted answers - jump to answer

Answers

  • MFGMFG Posts: 12Questions: 5Answers: 0

    Example is here: http://live.datatables.net/kuyiqoku/3/edit

    Original link included a period at the end and was invalid.

  • allanallan Posts: 63,461Questions: 1Answers: 10,466 Site admin
    Answer ✓

    The problem with using $().html() to replace HTML is that it regenerates the elements. I.e. the old ones which had the events bound to them are destroyed and replaced with the new elements, which don't have any events on them.

    Use the i18n options to change the language strings used by DataTables to your liking.

    Allan

  • MFGMFG Posts: 12Questions: 5Answers: 0

    That did the trick Allan.

    I used i18n to modify the object labels.

    I did end up using a jQuery statement to update the placeholder of the filter object. Since the jQuery statement used attr instead of html, I got what I needed.

    Thank you for your help.

    Updated example is at: http://live.datatables.net/kuyiqoku/7/edit

This discussion has been closed.