Sfoglia il codice sorgente

CHG Amelioration du fonctionnement des datatables

olivier.massot 7 anni fa
parent
commit
757552d689

+ 5 - 2
CD67.FicheCollege.MVC/Content/cd67-custom.less

@@ -265,11 +265,14 @@ header nav{
     padding: 0 1em;
 }
 
-.datatable tbody>tr:hover{
-    cursor: pointer;
+.datatable tbody>tr:hover, .simple-datatable tbody>tr:hover{
     background-color: lighten(@color1, 30%);
 }
 
+.datatable tbody>tr[data-url]:hover, .simple-datatable tbody>tr[data-url]:hover{
+    cursor: pointer;
+}
+
 .special_hidden {
     float: right;
     width: 0;

+ 8 - 9
CD67.FicheCollege.MVC/Scripts/cd67-main.js

@@ -25,15 +25,6 @@
         ]
     });
 
-    $('.datatable').on('click', 'tbody>tr', function () {
-        var sel = getSelection().toString(); // verifie qu'il ne s'agit pas d'une selection de texte
-        if (!sel && $(this).attr('data-url') !== undefined)
-        {
-            var url = $(this).data('url');
-            window.location.href = url;
-        }
-    });
-
     // Une datatable responsive simplifiée (sans pagination, recherche...etc).
     $('.simple-datatable').DataTable({
         "language": {
@@ -47,6 +38,14 @@
         ordering: true
     });
 
+    $('.datatable, .simple-datatable').on('click', 'tbody>tr', function () {
+        var sel = getSelection().toString(); // verifie qu'il ne s'agit pas d'une selection de texte
+        if (!sel && $(this).attr('data-url') !== undefined) {
+            var url = $(this).data('url');
+            window.location.href = url;
+        }
+    });
+
     //Conservation de la trace (pages d'admin)
     $("a.start-trace").on("click", function () {
         sessionStorage.setItem("trace", window.location);