Adding a RowClass to a function-type layout element

Adding a RowClass to a function-type layout element

paulh736paulh736 Posts: 9Questions: 6Answers: 0

I don't think this is a bug, it's just I can't figure it out. I'm on 2.1.3 and I'm using the new layout option and it's working great for me. I have a filters row which uses a function to return a jQuery object. I want to apply a class (a background colour) to the containing div so that the whole filter row is highlighted. I see the new RowClass and ClassName options but I can't figure out
where to put the option in relation to the existing code.

https://live.datatables.net/menunuga/1/edit

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,441Questions: 1Answers: 10,465 Site admin
    Answer ✓

    https://live.datatables.net/menunuga/2/edit

    The key is to use the structure:

    top: {
      rowClass: '...',
      features: [ ... ]
    }
    

    When you want to specify a row or cell class, you need to move the contents that you want to display into the features array.

    i.e.

    top: 'info'
    
    top: [ 'info' ]
    
    top: {
      info: {}
    }
    
    top: {
      features: [ 'info' ]
    }
    

    Are all functionally identical! The last form though, allows rowClass and friends to be used.

    Allan

  • paulh736paulh736 Posts: 9Questions: 6Answers: 0

    Awesome, thank you!

Sign In or Register to comment.