Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

custom styles not working, I think somethings overwrite them #7882


User avatar
0
wcdagency created

hello the following css is not working. I created a simple project , below code is working but  in aspnetzero .core project it is not working. something is overwritten them. what  are the correct ways to do it? (1) below code: it changes the color of clicked row var table1 = $('#TestDataTableId').DataTable();

$('#TestDataTableId tbody').on('click', 'tr', function () { if ($(this).hasClass('selected')) { $(this).removeClass('selected'); } else { table1.$('tr.selected').removeClass('selected'); $(this).addClass('selected'); } }); (2) below code: it changes the color of hovered rows <style>

<br> table.dataTable.display tbody tr:hover { background: yellow; }

&lt;/style>


4 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Yes, you are right. You have to override it;

    table.dataTable.display tbody tr:hover { background: yellow !important; }

  • User Avatar
    0
    wcdagency created

    Hello ismcagdas ,

    perfect! (2) ok!

    how abount (1)?

  • User Avatar
    0
    ismcagdas created
    Support Team

    Sorry, for #1, DataTables already has this fature, https://datatables.net/extensions/select/examples/initialisation/simple.html. You don't have to handle it manually.

  • User Avatar
    0
    ismcagdas created
    Support Team

    This issue is closed because it has not had recent activity for a long time.