Add class to a control using sDom

Add class to a control using sDom

rfarajrfaraj Posts: 3Questions: 0Answers: 0
edited January 2013 in General
I would like to add a bootstrap class of 'search-query' to the search input using sDom. Is this possible. The resulting markup would look something like...

[code]

Search:

[/code]

Thanks.

Replies

  • rfarajrfaraj Posts: 3Questions: 0Answers: 0
    Any ideas? I solved this by calling jQuery's addClass() after the datatable is rendered. This is less than ideal. Curious if there is a 'better' solution. Thanks in advance.
  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin
    Why less than ideal? There is no option built into DataTables to add a class to that element - standard jQuery manipulation of the DOM is how I'd do it.

    DataTables 1.11 will introduce the concept of renderers, where you will be able to define the HTML for the controls exactly, but they you need to define the whole lot, not just a single class.

    Allan
  • rfarajrfaraj Posts: 3Questions: 0Answers: 0
    edited January 2013
    Thank you for the reply.

    "less than ideal" because it seems like sDom is where the whole configuration exists for any custom control markup. nice to look in one place. You *could* use standard jQuery manipulation to add the markup that sDom allows us to add, but we don't ;)

    Looking forward to 1.11. You guys do an awesome job. Thanks.
This discussion has been closed.