grocy/js/viewjs/quantityunits.js
Katharina Bogad 2fbcefa8fd viewjs: scoped jquery
Most instances of $ have been replaced by $scope.
2021-06-23 15:00:53 +02:00

27 lines
722 B
JavaScript

function quantityunitsView(Grocy, scope = null)
{
var $scope = $;
if (scope != null)
{
$scope = $(scope).find;
}
var quantityUnitsTable = $scope('#quantityunits-table').DataTable({
'order': [[1, 'asc']],
'columnDefs': [
{ 'orderable': false, 'targets': 0 },
{ 'searchable': false, "targets": 0 }
].concat($.fn.dataTable.defaults.columnDefs)
});
$scope('#quantityunits-table tbody').removeClass("d-none");
Grocy.FrontendHelpers.InitDataTable(quantityUnitsTable);
Grocy.FrontendHelpers.MakeDeleteConfirmBox(
'Are you sure to delete quantity unit "%s"?',
'.quantityunit-delete-button',
'data-quantityunit-name',
'data-quantityunit-id',
'objects/quantity_units/',
'/quantityunits'
);
}