فهرست منبع

shift datatable child toggle function to api.js

FreddleSpl0it 2 سال پیش
والد
کامیت
645e8f426c
1فایلهای تغییر یافته به همراه14 افزوده شده و 0 حذف شده
  1. 14 0
      data/web/js/build/012-api.js

+ 14 - 0
data/web/js/build/012-api.js

@@ -380,4 +380,18 @@ $(document).ready(function() {
         $('#ConfirmDeleteModal').modal('hide');
         $('#ConfirmDeleteModal').modal('hide');
       });
       });
   });
   });
+
+  // toggle jquery datatables child rows
+  $('button[data-datatables-expand], a[data-datatables-expand]').on('click', function (e) {
+    e.preventDefault();
+    var tableId = e.target.getAttribute("data-datatables-expand");
+    var table = $("#" + tableId).DataTable();
+    table.rows(':not(.parent)').nodes().to$().find('td:first-child').trigger('click');
+  });
+  $('button[data-datatables-collapse], a[data-datatables-collapse]').on('click', function (e) {
+    e.preventDefault();
+    var tableId = e.target.getAttribute("data-datatables-collapse");
+    var table = $("#" + tableId).DataTable();
+    table.rows('.parent').nodes().to$().find('td:first-child').trigger('click');
+  });
 });
 });