Bootstrap select styling hides form elements

Bootstrap select styling hides form elements

smadersmader Posts: 21Questions: 6Answers: 0

Using the basic example: https://datatables.net/examples/api/form.html

When I add the Bootstrap 3 select option, when I have a row where elements are filled out and select, they become "hidden" by the styling of the select CSS.

Debug: http://debug.datatables.net/osocap

This question has accepted answers - jump to:

Answers

  • smadersmader Posts: 21Questions: 6Answers: 0
    edited July 2017

    Just wondering how (what) to override within CSS... Using Bootstrap 3.3.7.

    Showing the before / after clicking on the row.

    Thanks!

  • rduncecbrduncecb Posts: 125Questions: 2Answers: 28
    Answer ✓

    This is the css from select.bootstrap.css (in the Select extension) so providing your own definition in your own css with a different color should work:

    table.dataTable tbody tr.selected,
    table.dataTable tbody th.selected,
    table.dataTable tbody td.selected {
      color: white;
    }
    
    
  • allanallan Posts: 64,126Questions: 1Answers: 10,579 Site admin

    I'm not sure I fully understand the issue I'm afraid. It sounds like the Select stylesheet might not be getting included - but I'm not sure.

    Could you link to a page showing the issue, per the forum rules, please @smader.

    Thanks,
    Allan

  • rduncecbrduncecb Posts: 125Questions: 2Answers: 28
    Answer ✓

    @allan, From what I can tell, the text color turns white based on the default 'selected' Select stylesheet. However, because the inputs are light grey or white it's not easy / impossible to see the text in them.

  • smadersmader Posts: 21Questions: 6Answers: 0

    Hi all, thanks for the replies. @rduncecb has it. I have included an example here:

    http://live.datatables.net/fuzinuga/6

    I can get around the issue by forcing all children in the selected TR to be black as follows:

     $('#example tbody').on( 'click', 'tr', function () {
        $(this).children("*").css("color","black","important");
      });
    
  • rduncecbrduncecb Posts: 125Questions: 2Answers: 28
    Answer ✓

    @smader, you can override the default stylesheet rather than adding code to change the style of individual elements. It's a better way to achieve the same result in regards to styling elements, reduced javascript processing and separation of view and control. Also, 'important' should not be required in your example as element style is already higher specificity than any other selector.

    http://live.datatables.net/linitoze/1/edit

  • smadersmader Posts: 21Questions: 6Answers: 0

    Thanks @rduncecb, I've switch the implementation over to CSS.
    Cheers!

This discussion has been closed.