Jelajahi Sumber

Collèges: finalisation de l'index, export excel et pdf, fonctionnement sans JS

olivier.massot 7 tahun lalu
induk
melakukan
7e9f68aa7d

+ 5 - 1
CD67.FicheCollege.MVC/Scripts/cd67-main.js

@@ -18,7 +18,11 @@
         },
         responsive: {
             details: false
-        }
+        },
+        dom: 'Bfrtip',
+        buttons: [
+            'excel', 'pdf'
+        ]
     });
 
     $('.datatable').on('click', 'tbody>tr', function () {

+ 11 - 5
CD67.FicheCollege.MVC/Views/Colleges/Index.cshtml

@@ -17,7 +17,7 @@
     </span>
 </header>
 
-<table id="table-colleges" class="datatable table">
+<table id="table-colleges" class="datatable table" data-order="[[ 1, &quot;asc&quot; ]]">
     <thead>
         <tr>
             <th data-priority="1">
@@ -38,19 +38,20 @@
             <th>
                 @Html.DisplayNameFor(model => college_model.TypeCollege.Libelle)
             </th>
+            <noscript>
+                <td style="width:1px">
+                </td>
+            </noscript>
         </tr>
     </thead>
     <tbody>
-        @foreach (College college in Model.Obj.Colleges) {
+        @foreach (College college in Model.Obj.Colleges.OrderBy(c=>c.Libelle)) {
             <tr data-url="@Url.Action("Details", new { id = college.Id })">
                 <td>
                     @Html.DisplayFor(modelcollege => college.CodeRne)
                 </td>
                 <td>
                     @Html.DisplayFor(modelcollege => college.Libelle)
-                    <noscript class="no-print">
-                        @Html.ActionLink(" > Voir", "Details", new { id = college.Id })
-                    </noscript>
                 </td>
                 <td>
                     @Html.DisplayFor(modelcollege => college.Commune)
@@ -64,6 +65,11 @@
                 <td>
                     @Html.DisplayFor(modelcollege => college.TypeCollege.Libelle)
                 </td>
+                <noscript class="no-print">
+                    <td>
+                         @Html.ActionLink("Voir", "Details", new { id = college.Id })
+                    </td>
+                </noscript>
             </tr>
         }
     </tbody>