mirror of
https://github.com/grocy/grocy.git
synced 2026-04-05 20:36:15 +02:00
Fix datatable modals
This commit is contained in:
parent
5be9faed43
commit
4cde333d35
14
js/grocy.js
14
js/grocy.js
|
|
@ -378,6 +378,10 @@ class GrocyClass
|
||||||
grocyProxy.Initialize(proxy);
|
grocyProxy.Initialize(proxy);
|
||||||
self.LoadView(data.viewJsName, "#" + scopeId, proxy);
|
self.LoadView(data.viewJsName, "#" + scopeId, proxy);
|
||||||
},
|
},
|
||||||
|
onShown: () =>
|
||||||
|
{
|
||||||
|
grocyProxy.FrontendHelpers.OnShown();
|
||||||
|
},
|
||||||
onHide: () =>
|
onHide: () =>
|
||||||
{
|
{
|
||||||
grocyProxy.Unload();
|
grocyProxy.Unload();
|
||||||
|
|
@ -388,10 +392,16 @@ class GrocyClass
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
error: (xhr, text, data) => { console.error(text); }
|
error: (xhr, text, data) =>
|
||||||
|
{
|
||||||
|
console.error(text);
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
Unload()
|
||||||
|
{
|
||||||
|
return; // root grocy instances never get unloaded.
|
||||||
}
|
}
|
||||||
|
|
||||||
UndoStockBooking(bookingId)
|
UndoStockBooking(bookingId)
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ class GrocyFrontendHelpers
|
||||||
}
|
}
|
||||||
|
|
||||||
this.dropdowns = {}
|
this.dropdowns = {}
|
||||||
|
this.dataTables = [];
|
||||||
|
|
||||||
this.InitDropdowns();
|
this.InitDropdowns();
|
||||||
}
|
}
|
||||||
|
|
@ -249,6 +250,7 @@ class GrocyFrontendHelpers
|
||||||
|
|
||||||
InitDataTable(dataTable, searchFunction = null, clearFunction = null)
|
InitDataTable(dataTable, searchFunction = null, clearFunction = null)
|
||||||
{
|
{
|
||||||
|
this.dataTables.push(dataTable);
|
||||||
dataTable.columns.adjust().draw();
|
dataTable.columns.adjust().draw();
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
@ -275,6 +277,16 @@ class GrocyFrontendHelpers
|
||||||
self.$scope("#clear-filter-button").on("click", clearFunction || defaultClearFunction);
|
self.$scope("#clear-filter-button").on("click", clearFunction || defaultClearFunction);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This method is called if this FrontendHelper is scoped to a modal
|
||||||
|
// and the modal is acutally shown.
|
||||||
|
OnShown()
|
||||||
|
{
|
||||||
|
for (let table of this.dataTables)
|
||||||
|
{
|
||||||
|
table.columns.adjust();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
MakeFilterForColumn(selector, column, table, filterFunction = null, transferCss = false, valueMod = null)
|
MakeFilterForColumn(selector, column, table, filterFunction = null, transferCss = false, valueMod = null)
|
||||||
{
|
{
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,8 @@ class GrocyProxy
|
||||||
Object.assign(this.config.UserSettings, RootGrocy.UserSettings);
|
Object.assign(this.config.UserSettings, RootGrocy.UserSettings);
|
||||||
this.UserSettings = config.UserSettings;
|
this.UserSettings = config.UserSettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.unloaders = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
Initialize(proxy)
|
Initialize(proxy)
|
||||||
|
|
@ -55,6 +57,11 @@ class GrocyProxy
|
||||||
this.FrontendHelpers = new GrocyFrontendHelpers(proxy, this.RootGrocy.Api, this.scopeSelector);
|
this.FrontendHelpers = new GrocyFrontendHelpers(proxy, this.RootGrocy.Api, this.scopeSelector);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RegisterUnload(cb)
|
||||||
|
{
|
||||||
|
this.unloaders.push(cb);
|
||||||
|
}
|
||||||
|
|
||||||
Unload()
|
Unload()
|
||||||
{
|
{
|
||||||
for (let component in this.Components)
|
for (let component in this.Components)
|
||||||
|
|
@ -65,6 +72,13 @@ class GrocyProxy
|
||||||
comp.Unload();
|
comp.Unload();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let unloader = this.unloaders.pop();
|
||||||
|
while (unloader !== undefined)
|
||||||
|
{
|
||||||
|
unloader();
|
||||||
|
unloader = this.unloaders.pop();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Use(componentName, scope = null)
|
Use(componentName, scope = null)
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@
|
||||||
$scope('#stockentries-table tbody').removeClass("d-none");
|
$scope('#stockentries-table tbody').removeClass("d-none");
|
||||||
stockEntriesTable.columns.adjust().draw();
|
stockEntriesTable.columns.adjust().draw();
|
||||||
|
|
||||||
$.fn.dataTable.ext.search.push(function(settings, data, dataIndex)
|
var moreSearch = function(settings, data, dataIndex)
|
||||||
{
|
{
|
||||||
var productId = productpicker.GetValue();
|
var productId = productpicker.GetValue();
|
||||||
|
|
||||||
|
|
@ -44,6 +44,16 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
$.fn.dataTable.ext.search.push(moreSearch);
|
||||||
|
|
||||||
|
|
||||||
|
Grocy.RegisterUnload(() =>
|
||||||
|
{
|
||||||
|
var funcIdx = $.fn.dataTable.ext.search.indexOf(moreSearch);
|
||||||
|
if (funcIdx !== -1)
|
||||||
|
$.fn.dataTable.ext.search.splice(funcIdx);
|
||||||
});
|
});
|
||||||
|
|
||||||
$scope("#clear-filter-button").on("click", function()
|
$scope("#clear-filter-button").on("click", function()
|
||||||
|
|
|
||||||
|
|
@ -2150,3 +2150,9 @@ msgstr ""
|
||||||
|
|
||||||
msgid "Unable to print"
|
msgid "Unable to print"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Datum 1"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Datum ohne Zeit"
|
||||||
|
msgstr ""
|
||||||
|
|
|
||||||
|
|
@ -4,12 +4,17 @@
|
||||||
@section('activeNav', '')
|
@section('activeNav', '')
|
||||||
@section('viewJsName', 'stockjournalsummary')
|
@section('viewJsName', 'stockjournalsummary')
|
||||||
|
|
||||||
|
@php
|
||||||
|
$collapsed_none = $embedded ? '' : 'd-md-none';
|
||||||
|
$collapsed_flex = $embedded ? '' : 'd-md-flex';
|
||||||
|
@endphp
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<h2 class="title">@yield('title')</h2>
|
<h2 class="title">@yield('title')</h2>
|
||||||
<div class="float-right">
|
<div class="float-right">
|
||||||
<button class="btn btn-outline-dark d-md-none mt-2 order-1 order-md-3"
|
<button class="btn btn-outline-dark {{ $collapsed_none }} mt-2 order-1 order-md-3"
|
||||||
type="button"
|
type="button"
|
||||||
data-toggle="collapse"
|
data-toggle="collapse"
|
||||||
data-target="#table-filter-row">
|
data-target="#table-filter-row">
|
||||||
|
|
@ -21,7 +26,7 @@
|
||||||
|
|
||||||
<hr class="my-2">
|
<hr class="my-2">
|
||||||
|
|
||||||
<div class="row collapse d-md-flex"
|
<div class="row collapse {{ $collapsed_flex }}"
|
||||||
id="table-filter-row">
|
id="table-filter-row">
|
||||||
<div class="col-12 col-md-6 col-xl-2">
|
<div class="col-12 col-md-6 col-xl-2">
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user