grocy/js/viewjs/userentities.js
Katharina Bogad 2a7fbbecf8 Fix bugs
2021-06-24 22:18:19 +02:00

34 lines
837 B
JavaScript

function userentitiesView(Grocy, scope = null)
{
var $scope = $;
if (scope != null)
{
$scope = (selector) => $(scope).find(selector);
}
// preload some views.
Grocy.PreloadView("userentityform")
var userentitiesTable = $scope('#userentities-table').DataTable({
'order': [[1, 'asc']],
'columnDefs': [
{ 'orderable': false, 'targets': 0 },
{ 'searchable': false, "targets": 0 }
].concat($.fn.dataTable.defaults.columnDefs)
});
$scope('#userentities-table tbody').removeClass("d-none");
Grocy.FrontendHelpers.InitDataTable(userentitiesTable);
Grocy.FrontendHelpers.MakeDeleteConfirmBox(
'Are you sure to delete userentity "%s"?',
'.userentity-delete-button',
'data-userentity-name',
'data-userentity-id',
'objects/userentities/',
'/userentities'
);
}
window.userentitiesView = userentitiesView