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;
}
</style>
4 Answer(s)
-
0
Hi,
Yes, you are right. You have to override it;
table.dataTable.display tbody tr:hover { background: yellow !important; }
-
0
Hello ismcagdas ,
perfect!
(2) ok!how abount (1)?
-
0
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.
-
0
This issue is closed because it has not had recent activity for a long time.